Home » SQL & PL/SQL » SQL & PL/SQL » Passing value from one cursor to the other one.
Passing value from one cursor to the other one. [message #508693] Tue, 24 May 2011 02:03 Go to next message
AkilaSubramanian
Messages: 3
Registered: May 2011
Junior Member

I would like to know whether a value obtained from one cursor can be passed to the other cursor as a parameter and by passing it i want to retrieve a list of records and print only the records obtained from the second cursor where the value is passed.

I guess its nested loop. I'm new to this PL SQL concepts. Please help me out.
Re: Passing value from one cursor to the other one. [message #508706 is a reply to message #508693] Tue, 24 May 2011 02:38 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Some good books for you:
PL/SQL User's Guide and Reference
Application Developer's Guide - Fundamentals

For your question see the example at:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm#i45976

Regards
Michel

Re: Passing value from one cursor to the other one. [message #509279 is a reply to message #508706] Fri, 27 May 2011 00:37 Go to previous messageGo to next message
AkilaSubramanian
Messages: 3
Registered: May 2011
Junior Member

Thanks for the links.. but it would be easy for me to understand is someone could explain me in simple terms with any simple example..
Re: Passing value from one cursor to the other one. [message #509284 is a reply to message #509279] Fri, 27 May 2011 01:08 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Can you explain what you don't understand in the example and how to adapt it to your case.

Regards
Michel
Re: Passing value from one cursor to the other one. [message #663372 is a reply to message #509284] Wed, 31 May 2017 14:57 Go to previous messageGo to next message
ynkr999
Messages: 7
Registered: May 2017
Junior Member
Hi Michel,

could you dont mind can you help me please

I have a doubt,I have declared a explicit cursor in declarative section,then i have open that cursor in begin section,so when it will create
context area while we are open the cursor at that it will create context area or while we are declaring the cursor, that time it will create
context area




Regards
--------
Naveen
Re: Passing value from one cursor to the other one. [message #663373 is a reply to message #663372] Thu, 01 June 2017 00:31 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Please post your code.
I don't understand what you mean by "context area" in a PL/SQL context.

Re: Passing value from one cursor to the other one. [message #663418 is a reply to message #663373] Fri, 02 June 2017 09:34 Go to previous message
Bill B
Messages: 1971
Registered: December 2004
Senior Member
FOR PNT IN (SELECT COL1,COL2,COL3 FROM MYTABLE ORDER BY COL1) LOOP
  FOR PNT2 IN (SELECT COLA,COLB FROM OTHER_TABLE WHERE COLC = PNT.COL2) LOOP
   ... DO SOMETHING
  END LOOP;
END LOOP;
Previous Topic: Creating foreign key constraints for nested tables of user defined types oracle
Next Topic: Package to include a sleep inside a procedure
Goto Forum:
  


Current Time: Thu Mar 28 18:19:52 CDT 2024