select po.obj#, po.parttype, po.partcnt,
po.partkeycols,
po.flags,
-- hoist the next 2 queries up here because po.defts# may be null
-- and this avoids an outer join which is slooooow
(select ts.name from ts$ ts where po.defts# = ts.ts#),
(select ts.blocksize from ts$ ts where po.defts# = ts.ts#),
po.defpctfree, po.defpctused, po.defpctthres,
po.definitrans, po.defmaxtrans, po.deftiniexts, po.defextsize,
po.defminexts, po.defmaxexts, po.defextpct, po.deflists,
po.defgroups, po.deflogging, po.spare1,
-- Convert 'spare2' to a value that the pre-11.2 xsl stylesheet
-- can process: if archive compressed and version < 11.2,
-- turn off compression. The block format for archive compression
-- is not supported pre-11.2, so the compression bits must be
-- set to NOCOMPRESS.
-- also, exclude inmemory flags from exported 'spare2', as the flags
-- value would excede the range xsl div/mod can handle. IMC flags
-- are bytes 5 and above.
case when (bitand(floor(po.spare2/power(2, 32)),8+16+32+64)=0) or
(dbms_metadata.get_version >= '11.02.00.00.00')
then bitand(po.spare2, power(2, 40)-1)
else bitand(po.spare2, power(2, 32)-1) + 2*power(2, 32)
end,
trunc(po.spare2 / power(2, 40)),
po.spare3,
po.definclcol, po.parameters,
po.interval_str, po.interval_bival,
case when po.interval_str is not null then
cast( multiset( select * from ku$_insert_ts_view it
where it.base_obj_num=po.obj#
order by it.base_obj_num,it.position_num
) as ku$_insert_ts_list_t
)
else null end,
po.defmaxsize
from partobj$ po
SELECT PO.OBJ#
, PO.PARTTYPE
, PO.PARTCNT
,
PO.PARTKEYCOLS
,
PO.FLAGS
,
-- HOIST THE NEXT 2 QUERIES UP HERE BECAUSE PO.DEFTS# MAY BE NULL
--
AND THIS AVOIDS AN OUTER JOIN WHICH IS SLOOOOOW
(SELECT TS.NAME
FROM TS$ TS
WHERE PO.DEFTS# = TS.TS#)
,
(SELECT TS.BLOCKSIZE
FROM TS$ TS
WHERE PO.DEFTS# = TS.TS#)
,
PO.DEFPCTFREE
, PO.DEFPCTUSED
, PO.DEFPCTTHRES
,
PO.DEFINITRANS
, PO.DEFMAXTRANS
, PO.DEFTINIEXTS
, PO.DEFEXTSIZE
,
PO.DEFMINEXTS
, PO.DEFMAXEXTS
, PO.DEFEXTPCT
, PO.DEFLISTS
,
PO.DEFGROUPS
, PO.DEFLOGGING
, PO.SPARE1
,
-- CONVERT 'SPARE2' TO A VALUE THAT THE PRE-11.2 XSL STYLESHEET
-- CAN PROCESS: IF ARCHIVE COMPRESSED
AND VERSION < 11.2
,
-- TURN OFF COMPRESSION. THE BLOCK FORMAT FOR ARCHIVE COMPRESSION
-- IS NOT SUPPORTED PRE-11.2
, SO THE COMPRESSION BITS MUST BE
-- SET TO NOCOMPRESS.
-- ALSO
, EXCLUDE INMEMORY FLAGS
FROM EXPORTED 'SPARE2'
, AS THE FLAGS
-- VALUE WOULD EXCEDE THE RANGE XSL DIV/MOD CAN HANDLE. IMC FLAGS
-- ARE BYTES 5
AND ABOVE.
CASE WHEN (BITAND(FLOOR(PO.SPARE2/POWER(2
, 32))
, 8+16+32+64)=0) OR
(DBMS_METADATA.GET_VERSION >= '11.02.00.00.00')
THEN BITAND(PO.SPARE2
, POWER(2
, 40)-1)
ELSE BITAND(PO.SPARE2
, POWER(2
, 32)-1) + 2*POWER(2
, 32)
END
,
TRUNC(PO.SPARE2 / POWER(2
, 40))
,
PO.SPARE3
,
PO.DEFINCLCOL
, PO.PARAMETERS
,
PO.INTERVAL_STR
, PO.INTERVAL_BIVAL
,
CASE WHEN PO.INTERVAL_STR IS NOT NULL THEN
CAST( MULTISET( SELECT *
FROM KU$_INSERT_TS_VIEW IT
WHERE IT.BASE_OBJ_NUM=PO.OBJ#
ORDER BY IT.BASE_OBJ_NUM
, IT.POSITION_NUM
) AS KU$_INSERT_TS_LIST_T
)
ELSE NULL END
,
PO.DEFMAXSIZE
FROM PARTOBJ$ PO
|
|
|