|
|
Re: Ref Cursors VS. Cursors [message #45555 is a reply to message #45040] |
Tue, 23 March 2004 19:04   |
Shivakumar P
Messages: 2 Registered: March 2004
|
Junior Member |
|
|
Ref Cursor :
The cursor definition will be dynamic and wherever we want to change the select statement, we can change.
its declaration:
TYPE refcurname is REF CURSOR return datatype;
Definition :
OPEN refcurname for
select statement;
For ref cursor, there is no need of explicit call for open and close cursors.
Normal Cursor :
Just reverse of the ref cursor. only one and static definition to the cursor. You cannot define the same cursor more than once.instead you can only use it.
declaration & definition:
Cursor curname is
select statement;
Usage :
open curname;
fetch curname into variable;
close curname;
For this type of cursors, it requires explicit close and open functions to use.
i hope i cleared to some extent.
|
|
|
Re: Ref Cursors VS. Cursors [message #45556 is a reply to message #45040] |
Tue, 23 March 2004 19:24   |
Shivakumar P
Messages: 2 Registered: March 2004
|
Junior Member |
|
|
Hi guys,
slight changes in the reply i sent before.
You can use the OPEN and CLOSE functions to ref cursor for opening and closing the cursor as exactly as we are using in the normal cursors.
thank you,
|
|
|
|
Re: Ref Cursors vs Cursors [message #109513 is a reply to message #109500] |
Fri, 25 February 2005 03:31  |
William Robertson
Messages: 1643 Registered: August 2003 Location: London, UK
|
Senior Member |
|
|
A Ref Cursor is a variable, so you can pass it between procedures/functions. It is not necessarily dynamic.
For example, I had some migration code that needed to apply 15 different updates to a large set of data, so I wrote one procedure that did the actual update (bulk collect, FORALL, capture some stats at the end etc etc), and 15 procedures that simply declared a ref cursor and passed it to the update procedure.
|
|
|