Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Returning result from a pipelined function

Re: Returning result from a pipelined function

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Sat, 23 Nov 2002 16:52:27 -0000
Message-ID: <arobtm$cj8$4$8300dec7@news.demon.co.uk>

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>...

>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
Received on Sat Nov 23 2002 - 10:52:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US