在创建返回本地定义类型的本地流水线 PL/SQL 函数后,我发现无法使用它。有吗?本地是指函数和类型仅在其他一些 PL/SQL 块中可见,因此不能在 SQL 中使用:
declare
type foo_rec is record (
foo_id number,
foo_date date
);
type foo_tbl is table of foo_rec;
function get_some_foo
return foo_tbl pipelined
is
out_rec foo_rec;
begin
for cur in (
select 1 foo_id, sysdate foo_date from dual
union all
select 2 foo_id, sysdate+1 foo_date from dual
)
loop
out_rec.foo_date := cur.foo_date;
out_rec.foo_id := cur.foo_id;
pipe row(out_rec);
end loop;
end get_some_foo;
begin
null; -- how to use get_some_foo() here?
end;
/