Home » SQL & PL/SQL » SQL & PL/SQL » How to Pass values returned by refcusror to another cursor (Oracle 10.2.0.3, Windows 2003)
How to Pass values returned by refcusror to another cursor [message #359046] Thu, 13 November 2008 08:07 Go to next message
avik2009
Messages: 61
Registered: November 2008
Member
Hello Guys,

How to pass values returned from one cusror Cur1 to another cursor Cur2?

Re: How to Pass values returned by refcusror to another cursor [message #359050 is a reply to message #359046] Thu, 13 November 2008 08:48 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Be more specific, post an example.
You can use a parameter on the second cursor for instance.

Regards
Michel
Re: How to Pass values returned by refcusror to another cursor [message #359051 is a reply to message #359050] Thu, 13 November 2008 08:52 Go to previous messageGo to next message
avik2009
Messages: 61
Registered: November 2008
Member
What I want to say is that I am using a parameter and based on that I want to Fetch all the records using refcursor.And whatever I am getting through recursor I want to pass it to refcursor 2 and get the result.

Re: How to Pass values returned by refcusror to another cursor [message #359053 is a reply to message #359051] Thu, 13 November 2008 08:58 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Ref cursor or static cursor? This is not the same question.
Be more precise.
Post an example of what you want to do.

Also remember than one cursor is faster than 2 (use joins) and SQL is faster than cursor.

Regards
Michel
Re: How to Pass values returned by refcusror to another cursor [message #359199 is a reply to message #359053] Fri, 14 November 2008 01:44 Go to previous messageGo to next message
avik2009
Messages: 61
Registered: November 2008
Member
What I wanted to meant is that I want to pass a parameter to a sql and get the result using refcursor
and then whatever value I got from the refcursor I want to pass it to another cursor (refcursor2) and finally to get result from
the refcursor. Is it correct way I am doing? Or I should use one refcursor only using Subquery..
Re: How to Pass values returned by refcusror to another cursor [message #359210 is a reply to message #359199] Fri, 14 November 2008 02:56 Go to previous messageGo to next message
avik2009
Messages: 61
Registered: November 2008
Member
Approache I followed:


Create procedure proc1
( pgnum IN number,
Cur1 OUT SYS_REFCURSOR,
Cur2 OUT SYS_REFCURSOR)
as

Begin

Open Cur1 for

Select statement [where G_num=pgnum];

-- I want to pass Whatever result returned from Cur1 as parameter to fetch
data from another sql using reqfursor2.

End;



[Updated on: Fri, 14 November 2008 02:57]

Report message to a moderator

Re: How to Pass values returned by refcusror to another cursor [message #359217 is a reply to message #359210] Fri, 14 November 2008 03:11 Go to previous message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
You can't pass a returned value from cur1 until to cur2 before fetching, and you can only pass one value at open time.
I don't know what you finally want to achieve but I'm pretty sure it is not the good way.

Regards
Michel
Previous Topic: To Find a Top-level (uppermost) manager of a low-level employee
Next Topic: need a help in SQL
Goto Forum:
  


Current Time: Sun Feb 16 00:39:51 CST 2025