在我看来,我正在编写一个函数,以便调用类似
select get_foo() from dual;
或者
select * from table (get_foo);
返回相同的结果
select * from foo;
所以,我有一个可以编译的函数......
create or replace function get_foo return sys_refcursor as
rc_foo sys_refcursor;
begin
open rc_foo for 'select * from foo';
return rc_foo;
end;
但 select get_foo() from dual 返回 1 行。
((ID=1,NAME=Sarah1),(ID=2,NAME=Sarah2),(ID=3,NAME=Sarah3),)
而 select * from table( get_foo() ) 给了我 ORA-22905。
如何更改函数定义和/或调用以获得所需的结果?