【发布时间】:2015-03-02 10:38:56
【问题描述】:
例如,如果我有这种功能
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 无效标识符——pl/sql:ORA00904 错误。 我应该如何编码才能将 main_cur 作为参数传递给 test_pipe?
【问题讨论】:
-
您需要将
rowsource传递给流水线函数。游标只是指向结果集的指针。看我的回答。