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!

Rewrite union all to avoid double visit.

698658Aug 3 2011 — edited Aug 3 2011
Hi,
on 9.2.0.8

got query like this:
select * from (
select sum(bytes)/1024/1024 MB, segment_name , segment_type , (select table_name from dba_lobs where segment_name = s.segment_name) partition_name ,
 '---NULL--' part, '---NULL---' table_name    
from dba_segments s where s.tablespace_name = '&TBS' and s.segment_type <> 'LOB PARTITION' group by segment_name , segment_type
union all
select bytes/1024/1024 MB, segment_name , segment_type , partition_name, 
        (select partition_name from dba_lob_partitions where lob_name = s.segment_name and lob_partition_name = s.partition_name) part ,
        (select table_name from dba_lob_partitions where lob_name = s.segment_name and lob_partition_name = s.partition_name) table_name 
from dba_segments s where s.tablespace_name = '&TBS' and s.segment_type= 'LOB PARTITION'
) 
order by 1 desc;
Is there a batter way to deal with that case ?
Regards
GregG
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 31 2011
Added on Aug 3 2011
3 comments
105 views