谢谢你的善意
我在包的规范中声明了记录类型和记录表,我需要使用这个表类型作为管道函数的返回。
如果我将INDEX BY(某些东西)添加到表声明中,导致管道函数中的错误编译。为什么不能使用INDEX BY?
答案 0 :(得分:9)
documented你不能在流水线函数中使用索引(关联数组)。你必须使用嵌套表(没有“索引依据”或SQL类型定义的pl / sql数组)。
SQL> create or replace package testpkg
2 as
3 type test_rec is record(id number, id2 number);
4 type test_tab is table of test_rec index by binary_integer;
5
6 function test return test_tab pipelined;
7
8 end;
9 /
Warning: Package created with compilation errors.
SQL> show errors
Errors for PACKAGE TESTPKG:
LINE/COL ERROR
-------- -----------------------------------------------------------------
6/12 PLS-00630: pipelined functions must have a supported collection
return type
SQL> create or replace package testpkg
2 as
3 type test_rec is record(id number, id2 number);
4 type test_tab is table of test_rec;
5
6 function test return test_tab pipelined;
7
8 end;
9 /
Package created.
SQL>