2012-12-18 57 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> 
相关问题