如何在Oracle PL / SQL中使用返回本地类型的本地流水线函数?

时间:2015-08-14 20:23:13

标签: sql oracle plsql pipelined-function

在创建返回本地定义类型的本地流水线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;
/

0 个答案:

没有答案