In my package, I have defined a record type and a corresponding table type. I then have a pipelined function that opens a cursor and attempts to pipe each result out. The problem is that it’s giving me type mismatch errors. I tried to cast the cursor to my record type, but to no avail: What am I doing wrong?
create or replace package myTest as
type myRec is record(
id integer,
foo varchar2(10)
);
type myTable is table of myRec;
function output() return myTable pipelined;
end myTest;
/
create or replace package body myTest as
function output() return myTable pipelined
as
begin
for myCur in (
select id, foo from someTable
)
loop
pipe row(cast(myCur as myRec));
end loop;
return;
end output;
end myTest;
/
1 Answer