Create table tb_test (id number, description varchar2 (50))
Table created.
create or replace package pkg_test is
cursor cur_test is
select *
from tb_test
where 1=2;
type typ_cur_test is table of cur_test%rowtype;
function fn_test(p_rows in number) return typ_cur_test pipelined;
end;
Package created.
create or replace package body pkg_test is
function fn_test(p_rows in number) return typ_cur_test pipelined as
l_tab typ_cur_test := cur_typ_test();
begin
for i in 1..p_rows loop l_tab.extend;
l_tab(i).Id := i;
l_tab(i). Description := 'test';
pipe roe(l_tab(i));
end loop;
return ;
end;
end pkg_test;
Errors: PACKAGE BODY PKG_TEST Line/Col: 8/18 PLS-00103: Encountered the symbol "ROE" when expecting one of the following: := . ( @ % ; row The symbol ":=" was substituted for "ROE" to continue.More Details: https://docs.oracle.com/error-help/db/ora-24344
create or replace package body pkg_test is
function fn_test(p_rows in number)
return typ_cur_test pipelined as
l_tab typ_cur_test := cur_typ_test();
begin
for i in 1..p_rows loop l_tab.extend;
l_tab(i).Id := i;
l_tab(i). Description := 'test';
pipe row(l_tab(i));
end loop;
return ;
end;
end pkg_test;
Errors: PACKAGE BODY PKG_TEST Line/Col: 4/11 PL/SQL: Item ignored Line/Col: 4/27 PLS-00201: identifier 'CUR_TYP_TEST' must be declared Line/Col: 6/33 PLS-00320: the declaration of the type of this expression is incomplete or malformed Line/Col: 6/33 PL/SQL: Statement ignored Line/Col: 7/13 PLS-00320: the declaration of the type of this expression is incomplete or malformed Line/Col: 7/13 PL/SQL: Statement ignored Line/Col: 8/13 PLS-00320: the declaration of the type of this expression is incomplete or malformed Line/Col: 8/13 PL/SQL: Statement ignored Line/Col: 9/13 PL/SQL: Statement ignored Line/Col: 9/22 PLS-00320: the declaration of the type of this expression is incomplete or malformedMore Details: https://docs.oracle.com/error-help/db/ora-24344
create or replace package body pkg_test is
function fn_test(p_rows in number)
return typ_cur_test pipelined as
l_tab typ_cur_test := typ_cur_test();
begin
for i in 1..p_rows loop l_tab.extend;
l_tab(i).Id := i;
l_tab(i). Description := 'test';
pipe row(l_tab(i));
end loop;
return ;
end;
end pkg_test;
Package Body created.
Select * from table(pkg_test.fn_test(2))
ID | DESCRIPTION | 1 | test | 2 | test |
---|