关于 PL/SQL 包级记录类型的元数据

2021-12-24 00:00:00 reflection oracle plsql

假设您有一个定义了 RECORD 类型的 PL/SQL 包:

Suppose you have a PL/SQL package with a RECORD type defined:

CREATE OR REPLACE PACKAGE TEST_PACKAGE AS

    TYPE PERSON_RECORD_TYPE IS RECORD
    (
        first_name VARCHAR2(1000),
        last_name  VARCHAR2(1000)
    );

END;

有没有办法获取TEST_PACKAGE.PERSON_RECORD_TYPE 中包含的字段列表?例如,是否有任何带有此信息的 ALL_* 视图?

Is there any way to obtain a list of fields contained within TEST_PACKAGE.PERSON_RECORD_TYPE? For example, are there any ALL_* views with this information?

我对模式级记录类型不感兴趣,只对包级记录类型感兴趣.

I am not interested in schema-level record types, only package-level record types.

推荐答案

如果 PERSON_RECORD_TYPE 被用作某些过程或函数的参数或结果类型,您可以查询 ALL_ARGUMENTS.信息在那里稍微加密(记录和集合的多级封装的层次结构在 POSITION、SEQUENCE 和 DATA_LEVEL 列中编码),但是它存在.

If PERSON_RECORD_TYPE is used as argument or result type of some procedure or function, you can query ALL_ARGUMENTS. The information is little bit encrypted there (the hierarchy of multilevel encapsulation of records and collections is encoded in POSITION,SEQUENCE and DATA_LEVEL columns), however it is present.

我不认为这样的问题指向错误的架构.对于自动 PLSQL 代码生成,这是完全合法的请求,不幸的是,PLSQL 语言支持非常弱.

I don't think such a question points to wrong architecture. For automatic PLSQL code generation this is completely legitimate request, unfortunately with very weak PLSQL language support.

相关文章