A WITH clause is the ISO/ANSI terminology for "common table expression". A WITH clause provides a way to write named queries for use in a larger query
Questions tagged [with-clause]
67 questions
0
votes
2 answers
Referencing column from WITH-Subselect
The problem is as following:
I'm using a subquery and I need to join
WITH subselect_from_A AS (
SELECT A.A_ID FROM A
)
SELECT B.D_ID FROM B, subselect_from_A WHERE B.B_ID =
A.A_ID
/* or instead: subselect_from_A.A_ID */
;
How Do I reference…

Chris
- 1,119
- 1
- 8
- 26
0
votes
2 answers
Query with a "With" Clause inside a For Loop Cursor of DB2 PL SQL
I have a very complex query that includes a "With" clause. This query works fine when executed on the DB2 Client. But if the same query is used inside a For Loop Cursor of a PL SQL stored procedure it does not work. On trying to apply the stored…

Abhi
- 314
- 1
- 7
- 23
0
votes
1 answer
ORA-00904: invalid identifier in WITH clause - subquery factoring
I am getting following error, for the bellow query.
ORA-00904: "BKG_ITEM"."ITEM_NO": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action: Error at Line: 11 Column: 60
It seems BKG_ITEM and BKG are not identified by the…

Niroshan
- 2,064
- 6
- 35
- 60
0
votes
1 answer
Using Oracle's WITH clause in Java
How can I execute a query with Oracles's WITH clause in Java. For e.g
with TEST as (
select 1 from dual
)
select * from TEST
I tried but I get java.sql.SQLException: ORA-00928: missing SELECT keyword

nick
- 185
- 2
- 2
- 10
-1
votes
1 answer
MariaDB SQL Recursive query as subquery
I have a data structure where:
a vendor has a contingent (multiple vendors can use the same contingent, that's why it is different tables)
A contingent can also have a parent contingent (unlimited in depth)
If one of the contingents in the chain…

Dennis van de Hoef - Xiotin
- 1,481
- 1
- 13
- 29
-1
votes
1 answer
Oracle SQL grand query does not recognize column selected in with clause
I have sub query as table using with clause, the weird thing is that if I remove condition person_type.person.id = A.person_id it works fine, so it will recognize person_type.effective_start_date and person_type.effective_end_date from person_type…

Aasem Shoshari
- 37
- 1
- 7
-1
votes
1 answer
How can I write this correlated subquery by using with clause?
As you can see OrderDate is fetching details from ORDERS but ORDERS has reference in outer query, if I bring inner subquery and store in an object for using with clause that gives me an error. for reference of table I am putting link of tables to…

Raaj
- 11
- 3