Home » SQL & PL/SQL » SQL & PL/SQL » Looping through a Ref Cursor (10g)
Looping through a Ref Cursor [message #300602] Sat, 16 February 2008 10:14 Go to next message
amardilo
Messages: 37
Registered: February 2007
Member
Hi there.

I have a procedure which has an out value of a ref cursor (made up of different columns from different tables). I would like to call that procedure from another procedure and loop through each row.

I know how to call my stored procedure but I don't know how to loop through it.

Can anyone help?
Re: Looping through a Ref Cursor [message #300603 is a reply to message #300602] Sat, 16 February 2008 10:33 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You don't loop the procedure, you loop on the cursor that your procedure gives you.

Regards
Michel
Re: Looping through a Ref Cursor [message #300605 is a reply to message #300602] Sat, 16 February 2008 11:03 Go to previous messageGo to next message
amardilo
Messages: 37
Registered: February 2007
Member
Sorry what I mean is that I call my procedure which produces the cursor but I can't loop through the cursor.

DECLARE
 vCur 	my_package.MyCursor;
BEGIN
 my_package.my_procedure(vCur);
	 	 
--Loop goes here but not sure how to loop through it

END;



Re: Looping through a Ref Cursor [message #300606 is a reply to message #300605] Sat, 16 February 2008 11:08 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
PL/SQL User's Guide and Reference
Chapter 6 Performing SQL Operations from PL/SQL
Section
Fetching with a Cursor

Regards
Michel
Re: Looping through a Ref Cursor [message #559094 is a reply to message #300602] Thu, 28 June 2012 13:32 Go to previous messageGo to next message
Oraclekay
Messages: 2
Registered: June 2012
Junior Member
Did anyone find a solution for this? I am facing the exact same issue.
Re: Looping through a Ref Cursor [message #559097 is a reply to message #559094] Thu, 28 June 2012 13:43 Go to previous message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
And did you read the documentation I pointed to?

Regards
Michel
Previous Topic: Hirarchy Query and Tree Stucture (2 Merged)
Next Topic: Trying to view an user who is running long queries
Goto Forum:
  


Current Time: Sat Dec 10 22:19:02 CST 2016

Total time taken to generate the page: 0.07749 seconds