This is what I am think I am looking to do in package....but then how do I return the resultsets? Does this look right? Can I open p_cursor1 for cursor1 and PROCEDURE BA_TRD_PROC( P_CURSOR1 out cursorvar, P_CURSOR2 out cursorvar, P_START_DATE EV.TRDDATE%type, P_END_DATE EV.TRDDATE%type ) is begin cursor1 is select ID, other_stuff from x; cursor2 (p_ID in cursor1.ID%TYPE) is select whatever from y where ID = p_ID; open p_cursor1 for cursor1; open p_cursors2 for for outer_rec in cursor1 loop for inner_rec in cursor2(ID) loop ... end loop; end loop; Thanks Kathy -----Original Message----- From: Mercadante, Thomas F [mailto:thomas.mercadante@xxxxxxxxxxxxxxxxx] Sent: Wednesday, February 02, 2005 1:52 PM To: Duret, Kathy; Oracle L (E-mail) Subject: RE: is there a way to return multiple cursors from a query Kathy, OK. So they will get the first cursor back and process each record and call a second cursor - like a double loop? Or you could return both cursors at the same time and do what I suggested - the second cursor is returning the data as a result of the first cursor. I'm still having trouble understanding how you want this to work. Tom -----Original Message----- From: Duret, Kathy [mailto:kduret@xxxxxxxxxxxxxxxxxxxx] Sent: Wednesday, February 02, 2005 2:29 PM To: 'thomas.mercadante@xxxxxxxxxxxxxxxxx'; Oracle L (E-mail) Subject: RE: is there a way to return multiple cursors from a query no, they want two distinct cursors.... We had two procedures using dates for the parent and the child queries but the dates can be relied upon. (bad third party package, bad data, bad vendor...) So as not to break the original UI or have to change code (god forbid developers change their code here) I have to come up with another solution. Otherwise I agree with you. Kathy -----Original Message----- From: Mercadante, Thomas F [mailto:thomas.mercadante@xxxxxxxxxxxxxxxxx] Sent: Wednesday, February 02, 2005 1:21 PM To: Duret, Kathy; Oracle L (E-mail) Subject: RE: is there a way to return multiple cursors from a query Kathy, Why even return the first cursor? Why not return the second cursor with the results of the first cursor already wrapped in the second? Does this make sense? What they *really* want is the results from the second cursor. So why not just give it to them with enough items in the select list so they can get the data they want? Tom -----Original Message----- From: Duret, Kathy [mailto:kduret@xxxxxxxxxxxxxxxxxxxx] Sent: Wednesday, February 02, 2005 1:56 PM To: Oracle L (E-mail) 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 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. 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