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!

UNION ORDER BY 00904. 00000 - "%s: invalid identifier"

976692Nov 28 2012 — edited Nov 28 2012
I'm using 11g R2 64bit
Why this does not execute ?

select 1 a from dual
union
select 2 from dual
union
select 3 from dual
order by a
;

ORA-00904: "A": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error at Line: 16 Column: 9

This works fine:
select 1 a from dual
union
select 2 a from dual
union
select 3 a from dual
order by a
;

And this works:
select 1 a from dual
union
select 2 from dual
--union
--select 3 from dual
order by a
;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 26 2012
Added on Nov 28 2012
15 comments
13,626 views