我们可以使用record_name.field%type来引用字段的类型...
但如果字段是一个集合(表为...)%类型是集合类型。
有没有一种使用%type或类似的方法来引用集合元素类型?
declare
type rec1_t is record (
n1 integer
);
type rec1_tab_t is table of rec1_t;
type rec2_t is record (
x rec1_tab_t
);
x1 rec2_t;
x2 x1.x%type;
begin
null;
end;
/
因此,在本例中,x2的类型为Rec1_Tab_t。
我希望在给定变量的情况下,引用元素的类型Rec1_Tab_t,即Rec1_t。
declare
x2 x1.x(1)%type
1条答案
按热度按时间ekqde3dh1#
对不起,AFAIK无法在Oracle的PL/SQL中引用集合的元素类型。
%TYPE
和%ROWTYPE
属性的用法在Oracle数据库文档《数据库PL/SQL语言参考》一书中定义,请参阅版本19c,此处为https://docs.oracle.com/en/database/oracle/oracle-database/19/lnpls/index.html