How can one use a local pipelined function returning a local type in Oracle PL/SQL?

293 Views Asked by At

After creation of a local pipelined PL/SQL function returning locally defined type I found no way to use it. Is there one? By being local I mean the function and the type is visible only within some other PL/SQL block and therefore cannot be used in 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;
/
0

There are 0 best solutions below