Home » SQL & PL/SQL » SQL & PL/SQL » difference between cursor and refcursor ?
difference between cursor and refcursor ? [message #223794] Sun, 11 March 2007 12:14 Go to next message
sherya
Messages: 11
Registered: February 2007
Location: noida, sec-15
Junior Member
hello all

can any one please tell me what is the difference between cursor and ref-cursor ?

by the help of cursor we get values from database then why should we use ref cursor.

ref- cursor also act dynamacialy where as cursor behaves static
but i dny kn how it behave dynamically?

suppose we entre in-parameter and with the help of cursor we get out values. why should we use ref-cursor.

can any one make me clear about it.

i will be very thankful to u


regards
Re: difference between cursor and refcursor ? [message #223795 is a reply to message #223794] Sun, 11 March 2007 12:26 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
See a ref cursor as a pointer to a cursor. A ref cursor can, for example, be returned from a stored procedure to the calling module. The calling module then fetches the records.
Re: difference between cursor and refcursor ? [message #223801 is a reply to message #223794] Sun, 11 March 2007 13:11 Go to previous messageGo to next message
sherya
Messages: 11
Registered: February 2007
Location: noida, sec-15
Junior Member
thanxx frank..

from ur answer, i come to know something about ref cursor.

can u provide me a bit of help ?

difference is a ref cursor can be passed from subroutine to subroutine -- a cursor cannot be. -- >what does subroutine means ?


regards
Re: difference between cursor and refcursor ? [message #223808 is a reply to message #223801] Sun, 11 March 2007 14:24 Go to previous messageGo to next message
William Robertson
Messages: 1640
Registered: August 2003
Location: London, UK
Senior Member
A ref cursor is a variable that can be passed around between procedures (and it is passed by reference). A plain old cursor (as in "CURSOR c IS SELECT ...") cannot be passed as a variable.
Re: difference between cursor and refcursor ? [message #223810 is a reply to message #223808] Sun, 11 March 2007 14:38 Go to previous messageGo to next message
sherya
Messages: 11
Registered: February 2007
Location: noida, sec-15
Junior Member
thanx William Robertson

can u plz tell me in which situation we use ref cursor or cursor.


regards
Re: difference between cursor and refcursor ? [message #223812 is a reply to message #223810] Sun, 11 March 2007 14:53 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
You know what?
We provided you with quite some starting points. Combine these with the links in the sticky and spend some time reading the manuals.
If you still don't know the answer, come back and we will help you on your way.

[Edit: typo]

[Updated on: Sun, 11 March 2007 14:53]

Report message to a moderator

Re: difference between cursor and refcursor ? [message #223814 is a reply to message #223810] Sun, 11 March 2007 15:44 Go to previous messageGo to next message
William Robertson
Messages: 1640
Registered: August 2003
Location: London, UK
Senior Member
Use a regular cursor unless you need a variable that can be passed around by reference between procedures, or unless you need a dynamic cursor e.g. "OPEN rc FOR some_dynamic_string".
Re: difference between cursor and refcursor ? [message #223877 is a reply to message #223814] Mon, 12 March 2007 03:09 Go to previous message
bonker
Messages: 402
Registered: July 2005
Senior Member
Read this link

http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:14188501024541

Previous Topic: where we will use Cursor in Fun and Procedure?
Next Topic: query to find second highest sal
Goto Forum:
  


Current Time: Sat Dec 10 16:55:31 CST 2016

Total time taken to generate the page: 0.10831 seconds