Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Returning result from a pipelined function
I haven't tried this, so I don't know if it should work:
Declare localfunc as a pipelined function
Replace the call to localfunc() with some variant of
for r in (select * from table(cast localfunct(counter) as ...) loop
This assumes that you can declare pipelined functions as local functions, of course.
-- Regards Jonathan Lewis http://www.jlcomp.demon.co.uk Next Seminar dates: (see http://www.jlcomp.demon.co.uk/seminar.html ) ____England______January 21/23 The Co-operative Oracle Users' FAQ http://www.jlcomp.demon.co.uk/faq/ind_faq.html Alexander Miroshnikov wrote in message <83192647.0211210356.19de1169_at_posting.google.com>...Received on Sat Nov 23 2002 - 10:52:27 CST
>I am writing a pipelined function that returns a dataset
>
>:
>: create or replace type stringlist as
>: table of varchar2(100)
>: /
>:
>: create or replace function test return stringlist pipelined as
>: begin
>: for counter in 1..100000000 loop
>: pipe row(counter);
>: end loop;
>: return;
>: end;
>: /
>:
>
>It works.
>
>Unfortunately the logic of my function is slightly more complex (I
need
>recursion) and in order to implement it I would like to push data
into
>the pipe from a local routine declared inside my function -
>
>:
>: create or replace function test return stringlist pipelined as
>: procedure localfunc ( value integer ) as
>: begin
>: pipe row(counter);
>: .. recursive logic ..
>: end;
>: begin
>: for counter in 1..100000000 loop
>: localfunc (counter);
>: end loop;
>: return;
>: end;
>: /
>:
>
>This does not work because Oracle assumes that "pipe row" pushes the
>data through the pipe associated with "localfunc" routine that is not
>declared as pipelined, etc.
>
>Is there a decent workaround for this problem?
>
>Any help would be appreciated.
>
>Regards,
>Alex