我有 2 个输出正确的工作查询。第一个查询给出表名列表和计数,第二个查询给出表名列表、MB 大小和表空间名称。
如何将它们组合到一个查询中?
查询一:
select table_name
,to_number(extractvalue(xmltype(
dbms_xmlgen.getxml(
'select count(*) c from '||table_name))
,'/ROWSET/ROW/C')) count
from user_tables
where table_name like 'AUD_2012080%'
order by table_name desc;
查询 2:
select segment_name,blocks*8192/1024/1024 as MB,tablespace_name
from dba_segments
where segment_name like 'AUD_2012080%'
order by segment_name desc;
输出1:
TABLE_NAME COUNT
------------------------------ ----------
AUD_20120809 27967
AUD_20120808 28269
AUD_20120807 29354
AUD_20120806 27155
AUD_20120805 18042
AUD_20120804 19033
AUD_20120803 24642
AUD_20120802 26760
AUD_20120801 25776
输出 2:
SEGMENT_NAME MB TABLESPACE_NAME
-------------------- ---------- ------------------------------
AUD_20120809 35 WSS_BIG_I
AUD_20120808 35 WSS_BIG_I
AUD_20120807 36 WSS_BIG_I
AUD_20120806 34 WSS_BIG_I
AUD_20120805 24 WSS_BIG_I
AUD_20120804 24 WSS_BIG_I
AUD_20120803 29 WSS_BIG_I
AUD_20120802 32 WSS_BIG_I
AUD_20120801 30 WSS_BIG_I
我正在寻找的结果是:
Table_name count owner MB Tablespace_name
AUD_20120801 25776 auditor 30 wss_big_i
...
...