我需要創建一個函數來返回一個記錄表。過濾將基於函數的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'));
,但是當我想改變REC記錄的結構到
...
type rec is record
(t0 UROWID
, t1 table_a.test_1%type
, t2 table_a.test_a%type
, t3 table_a.test_b%type
);
...
添加新的T0問題引發列如果類型UROWID生成我的錯誤:
PLS-00630: pipelined functions must have a supported collection return type
但我該如何解決它?
非常感謝。
'表A'需要改變,而新的't0'必須添加 – piyushj