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 Query without sorting

697586Apr 22 2009 — edited Apr 22 2009
Hi all,

Is there any way to perform union query without sorting based on the 1st column?

Eg.

CLEAR SCREEN
CLEAR BREAKS
CLEAR COLUMNS

SET HEADING OFF
SET FEEDBACK OFF

alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';

select 'Database Information Report for ' ||instance_name|| ' retrieved on ' ||sysdate from v_$instance,dual;

select 'Hostname : ' || host_name from v_$instance
union
select 'Version : ' || banner from v$version where banner like 'Oracle%'
union
select 'Instance Name : ' || instance_name from v_$instance
union
select 'Started At : ' || to_char(startup_time,'DD-MON-YYYY HH24:MI:SS') stime from v_$instance
union
select 'Database Log Mode : ' || LOG_MODE from v_$database
union
select 'Uptime : ' || floor(sysdate - startup_time) || ' days(s) ' ||
trunc( 24*((sysdate-startup_time) -
trunc(sysdate-startup_time))) || ' hour(s) ' ||
mod(trunc(1440*((sysdate-startup_time) -
trunc(sysdate-startup_time))), 60) ||' minute(s) ' ||
mod(trunc(86400*((sysdate-startup_time) -
trunc(sysdate-startup_time))), 60) ||' seconds' uptime from v_$instance;

Returned result executing the above sorts the arrangement irregardless of the query sequence from the above union query:

+Database Information Report for [Instance name] retrieved on 22-APR-2009 18:00:39+

Database Log Mode :
Hostname :
Instance Name :
Started At :
Uptime :
Version :

Is there any way not to sort it?

Thanks in advance.

Eugene
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 20 2009
Added on Apr 22 2009
11 comments
915 views