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!

Order of Result sets when using UNION ALL

Peter GjelstrupMar 13 2012 — edited Mar 13 2012
Hello members,

I was wondering if this behaviour is guaranteeed (As in safe to rely on):
SQL> select 'Header' report from dual
UNION ALL
select 'Lines' from dual connect by level <=3;

REPORT
--------
Header  
Lines   
Lines   
Lines   

4 rows selected.
I know about the usual "No order guaranteed, without order by". But thought this might be different.

I am interested in finding out if I can rely on "Header" always to come first.

Any comments?

Best regards
Peter

SQL> select * from v$version where rownum = 1

BANNER                                                          
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
1 row selected.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 10 2012
Added on Mar 13 2012
4 comments
417 views