例如管道函数,如果我有这种功能
与光标参数预言
function test_pipe(p_source in t_cursor)
return t_tab
pipelined
as --some code goes here
t_cursor是一个引用游标。 我知道如果我在一个包声明光标并希望将它作为参数传递我可以调用这个函数像
select * from table(test_pipe(cursor(select 1 from dual)));
但什么。 这样的事情。
procedure test is
v_ct pls_integer;
cursor main_cur is select 1 from dual;
begin
select count(*) into v_ct from table(test_pipe(main_cur));
--some code
end;
,我得到main_cur无效identifier-- PL/SQL:ORA00904错误。 我该如何编写代码才能将main_cur作为参数传递给test_pipe?
您将n eed将'rowsource'传递给流水线功能。游标只是指向结果集的指针。看到我的答案。 – 2015-03-02 12:16:12