レコードのテーブルを返す関数を作成する必要があります。フィルタリングは、関数のINパラメータに基づいて実行されます。テーブルからレコードのテーブルに値をフェッチする方法
一般的に、それは非常に簡単に次のコードを実行される:
CREATE TABLE TABLE_A
(
TEST_1 NUMBER
, TEST_A VARCHAR2(1 BYTE)
, TEST_B VARCHAR2(1 BYTE)
) ;
Insert into TABLE_A (TEST_1,TEST_A,TEST_B) values (1,'a','b');
Insert into TABLE_A (TEST_1,TEST_A,TEST_B) values (2,'a','b');
create or replace package test_package as
type rec is record
(t1 table_a.test_1%type
, t2 table_a.test_a%type
, t3 table_a.test_b%type
);
TYPE col_table_1 is table of rec;
function test_plsql_table(par1 varchar2) return col_table_1 pipelined;
end;
create or replace package body test_package as
function test_plsql_table(par1 varchar2) return col_table_1 PIPELINED as
cursor temp_cur is
SELECT * FROM table_a where test_a = par1;
begin
for cur_rec in temp_cur loop
pipe row(cur_rec);
end loop;
end;
end;
SELECT * from TABLE(test_package.test_plsql_table('a'));
が、私は新しいT0を追加
...
type rec is record
(t0 UROWID
, t1 table_a.test_1%type
, t2 table_a.test_a%type
, t3 table_a.test_b%type
);
...
にRECレコードの構造を変更する場合の問題が提起します列UROWIDがエラーを生成する場合:
PLS-00630: pipelined functions must have a supported collection return type
どうすれば解決できますか それ?
ありがとうございます。
'テーブルA'を変更する必要があり、新しい' t0'が – piyushj