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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Select from a function that returns a CURSOR

Re: Select from a function that returns a CURSOR

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: Thu, 04 Oct 2007 14:43:55 -0700
Message-ID: <1191534235.841635.230250@y42g2000hsy.googlegroups.com>


On Oct 3, 12:26 pm, ronscottlang..._at_yahoo.com wrote:
> I have an outer query with subquery something like
>
> select * from
> (select * from dataset ds where ds.periodType = pt)
>
> The inner subquery in my real code is actually much more complex and
> needs to be used as an inner query in several other places. I would
> like to move this inner query to a re-useable function (or
> something...)
>
> I tried creating a function that returned a cursor and then do
> something like..
>
> select * from doQuery(pt)
>
> but I guess this is not possible. Can't really use a View since I
> need to pass parameters to the inner query.
>
> fyi, the returned data from the query can be very large, so probably
> best not to load into internal array or table.
>
> I guess if I was able to do something like this, then chance I may
> lose some of Oracle's optimizations without it knowing really what is
> being returned.
>
> Any suggestions? copy/paste :)
>
> Thanks,
> Ron

Ron, are you sure you just cannot use a view and then when you select against the view have the select provide additional filtering condition(s).

HTH -- Mark D Powell -- Received on Thu Oct 04 2007 - 16:43:55 CDT

Original text of this message

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