Re: is there a way to return multiple cursors from a query

  • From: david wendelken <davewendelken@xxxxxxxxxxxxx>
  • To: "Oracle L (E-mail)" <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 2 Feb 2005 11:22:48 -0800 (PST)

From your description, it only sounds like you need two cursors returned 
because you want to pass the first cursor result to the second query.  If so, 
why not just combine the two queries into one statement and return the cursor 
from that statement?

Example:

select p.col_a, p.col_b, c.col_c, c.col_d
from (select x.col_a, x.col_b
            from parent_table x
           where complicated_filter_test = 'Y'
        ) p
       ,child_table c
where p.col_a = c.col_a
   and p.col_b = c.col_b

Tuned properly, the time-consuming filter logic on the parent table only gets 
executed once per parent row instead of once per child row.  I've had success 
trying this approach before.

And, of course, you could always put the parent_table query in a view for 
re-use purposes.


-----Original Message-----
From: "Duret, Kathy" <kduret@xxxxxxxxxxxxxxxxxxxx>
Sent: Feb 2, 2005 10:55 AM
To: "Oracle L (E-mail)" <oracle-l@xxxxxxxxxxxxx>
Subject: is there a way to return multiple cursors from a query

what I need to do is return a cursor from one query in a procedure.... no
problemo


What I need to do is :

for every ID returned in the first query returned ....use this in the where
condition of the child query.

Yes they want two separate cursors returned.  so a function is out.

The first query is intensive so I don't want to execute it twice.

This will be executed quite a bit and returns a fair amount of data.

Thanks,

Kathy







This transmission contains information solely for intended recipient and may
be privileged, confidential and/or otherwise protect from disclosure.  If
you are not the intended recipient, please contact the sender and delete all
copies of this transmission.  This message and/or the materials contained
herein are not an offer to sell, or a solicitation of an offer to buy, any
securities or other instruments.  The information has been obtained or
derived from sources believed by us to be reliable, but we do not represent
that it is accurate or complete.  Any opinions or estimates contained in
this information constitute our judgment as of this date and are subject to
change without notice.  Any information you share with us will be used in
the operation of our business, and we do not request and do not want any
material, nonpublic information. Absent an express prior written agreement,
we are not agreeing to treat any information confidentially and will use any
and all information and reserve the right to publish or disclose any
information you share with us.
--
//www.freelists.org/webpage/oracle-l

--
//www.freelists.org/webpage/oracle-l

Other related posts: