如何获取在给定包中声明的所有类型的数据的信息

如何获取在给定包中声明的所有类型的数据的信息

问题描述:

如何使用字典视图中的信息来获取Oracle 11g中给定包中声明的所有类型的数据的信息。

How can I use information from the dictionary views to get information on all types of data declared in a given package in Oracle 11g.

使用PL / Scope ...

Use PL/Scope ...

alter session set plscope_settings = 'IDENTIFIERS:ALL';

...并重新编译包( UTL_LOG 在我的case)...

... and recompile the package (UTL_LOG in my case) ...

alter package utl_log compile;
alter package utl_log compile body;

...然后查询 user_identifiers view ...

... and then query the user_identifiers view ...

select name, type, object_name, object_type, line, col
from user_identifiers
where object_name = 'UTL_LOG'
    and usage = 'DECLARATION'
    and type not in ('VARIABLE','FUNCTION','FORMAL IN','FORMAL OUT','CONSTANT','PROCEDURE','FUNCTION','PACKAGE')
;

...(在我的例子中)yield ...

... which would (in my case) yield ...

NAME                TYPE    OBJECT_ OBJECT_ LINE COL
------------------- ------- ------- ------- ---- ---
ARR_SOME_COLLECTION VARRAY  UTL_LOG PACKAGE   19   6
REC_SOME_RECORD     RECORD  UTL_LOG PACKAGE   15   6
TYP_LOG_CODE        SUBTYPE UTL_LOG PACKAGE    8   9

请注意,PL / Scope可用于任何程序单元中声明/定义的任何标识符,而不仅仅是数据类型声明。

Please note that PL/Scope can be used for any identifier declared/defined in any program unit, not only for data type declarations.