1

ご親切にありがとうございます。
パッケージの仕様でレコードの種類とレコードのテーブルを宣言します。このテーブルの種類をパイプライン関数の戻り値として使用する必要があります。
テーブル宣言に INDEX BY (何か) を追加すると、パイプライン関数でコンパイル エラーが発生しました。INDEX BY を使用できないのはなぜですか?

4

1 に答える 1

9

パイプライン関数ではインデックスバイ (連想配列) を使用できないことが文書化されています。ネストされたテーブルを使用する必要があります (「index by」または 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>
于 2013-01-31T08:10:17.647 に答える