Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamic sql into cursor return pipe row

668136Jul 5 2011 — edited Jul 5 2011
Hi,

Can anoyne help me?

I want to create a function that returns a pipelined object.

I've create an oracle type and a collection, lets say:

CREATE OR REPLACE type line_man as object ( sld varchar2(2),
num number,
user_t varchar2(10));

CREATE OR REPLACE type table_man as table of line_man;

After that i've created a function that returns a pipelined:


create or replace function man_tst (p_1 in number,
p_2 in number,
p_3 in number) return table_man pipelined is
vStm varchar2(4000);
v_cur sys_refcursor;
s_cur line_man;
begin
vStm := 'select sld, num, user_t from table_1 where 1=1';
--some code that could change the where clause
...
open v_cur for vstm;
loop
fetch v_cur into s_cur;
exit when v_cur%notfound;
pipe row (table_man (s_cur));
end loop;
end man_tst ;


But when i try to compile it gives me an error:
[Error] PLS-00382 (167: 15): PLS-00382: expression is of wrong type

What am i doing wrong? That is how am i suppose to pass the values to the pipe row?

Thanks
This post has been answered by Billy Verreynne on Jul 5 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 2 2011
Added on Jul 5 2011
6 comments
3,970 views