集合的元素类型的%type

nuypyhwy  于 2022-09-18  发布在  Java
关注(0)|答案(1)|浏览(212)

我们可以使用record_name.field%type来引用字段的类型...

但如果字段是一个集合(表为...)%类型是集合类型。

有没有一种使用%type或类似的方法来引用集合元素类型?

  1. declare
  2. type rec1_t is record (
  3. n1 integer
  4. );
  5. type rec1_tab_t is table of rec1_t;
  6. type rec2_t is record (
  7. x rec1_tab_t
  8. );
  9. x1 rec2_t;
  10. x2 x1.x%type;
  11. begin
  12. null;
  13. end;
  14. /

因此,在本例中,x2的类型为Rec1_Tab_t。

我希望在给定变量的情况下,引用元素的类型Rec1_Tab_t,即Rec1_t。

  1. declare
  2. x2 x1.x(1)%type
ekqde3dh

ekqde3dh1#

对不起,AFAIK无法在Oracle的PL/SQL中引用集合的元素类型。

%TYPE%ROWTYPE属性的用法在Oracle数据库文档《数据库PL/SQL语言参考》一书中定义,请参阅版本19c,此处为https://docs.oracle.com/en/database/oracle/oracle-database/19/lnpls/index.html

相关问题