2012-12-18 95 views

回答

1

10g中的這個信息在那裏,但根本沒有暴露給我們。所以你只有幾個選擇。 (在11g其只在ALL視圖,而不是DBA/USER一個,除非他們已經補充說,在最近的補丁)

  1. dba_source將有它,但多數民衆贊成在SQL的手動分析得到了這一點。

  2. 您可以創建連接到sys.attribute $並提取decode(bitand(properties, 4096), 4096, 'C', 'B')

  3. 你可以修改現有的* type_attr意見(雖然這不會由Oracle支持)一個新的視角。只需在視圖選擇部分中添加decode(bitand(a.properties, 4096), 4096, 'C', 'B')(其中「a」是對sys.attribute $的引用)。

新視圖的一個例子..

SQL> select * from v$version; 

BANNER 
---------------------------------------------------------------- 
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi 
PL/SQL Release 10.2.0.4.0 - Production 
CORE 10.2.0.4.0  Production 
TNS for Linux: Version 10.2.0.4.0 - Production 
NLSRTL Version 10.2.0.4.0 - Production 

SQL> create view type_chars 
    2 as 
    3 select ta.owner, ta.type_name, ta.attr_name, decode(bitand(a.properties, 4096), 4096, 'C', 'B') char_used 
    4 from sys.attribute$ a, sys.type$ t, sys.obj$ o, dba_objects ob, dba_type_attrs ta 
    5 where ta.owner = ob.owner 
    6 and ta.type_name = ob.object_name 
    7 and a.toid = t.toid 
    8 and a.version# = t.version# 
    9 and t.toid = o.oid$ 
10 and o.subname is null 
11 and ob.object_id = o.obj# 
12 and a.name = ta.attr_name; 

View created. 

SQL> create type mytype as object (a varchar2(20), b number, c varchar2(30 char)); 
    2/

Type created. 

SQL> select * from type_chars where type_name = 'MYTYPE' and owner= user; 

OWNER       TYPE_NAME      ATTR_NAME      C 
------------------------------ ------------------------------ ------------------------------ - 
DTD_TRADE      MYTYPE       A        B 
DTD_TRADE      MYTYPE       B        B 
DTD_TRADE      MYTYPE       C        C 

SQL> 
相關問題