Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

bug(?) using WITH and UNION

388549Feb 24 2003 — edited Feb 24 2003
I'm trying to use a WITH clause along with a UNION and getting an error. I've simplified things for test purposes to the following (not very useful, but shows the error) query (in scott/tiger)

with e as
(
select c1.empno as e1, c2.empno as e2, c3.empno as e3 from
emp c1 join emp c2 on c1.empno = c2.empno
join emp c3 on c3.empno = c2.empno
)
select e1 from e
union
select e3 from e

The error message is

ORA-00604: error occurred at recursive SQL level 1
ORA-00904: "from$_subquery$_003"."EMPNO_8_8": invalid identifier

If I don't use the union - or if I remove the third join (with c3) then the error doesn't happen.

I'm using 9i Release 2 (9.2.0.1.0) for Windows

Is this a bug? Or am I doing something wrong?

The basic problem is that I have a complex query which returns 3 columns, all of the same type, and I want to get the concatenation of all values of all three columns into one column. Any ideas?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 24 2003
Added on Feb 24 2003
1 comment
257 views