<<Previous Next>>
Oracle - What is a cursor
variable? - Feb 07, 2010 at 14:20 PM by Shuchi
Gauri
What is a cursor
variable?
In case of a cursor, Oracle opens an anonymous
work area that stores processing information. This area can be
accessed by cursor variable which points to this area. One must
define a REF CURSOR type, and then declare cursor variables of that
type to do so.
E.g.:
/* Create the cursor type. */ TYPE
company_curtype IS REF CURSOR RETURN company%ROWTYPE;
/* Declare a cursor variable of that type.
*/ company_curvar company_curtype;
Oracle - What
is a cursor variable? - April 10, 2009 at 11:00
AM
What is a cursor variable?
A cursor variable is capable to get
associated with different SELECT statements at run time. It is a
reference type which is quite similar to pointer in C. In order to
use cursor variable, it has to be declared first, and then the
storage has to be allocated.
Oracle - What is a cursor variable? - June
18, 2009 at 15:00 PM
A cursor variable is a variable of REF CURSOR data type which is
a pointer to a data structure resource.
It connects to query statement result, similar to the CURSOR data
type.
To define cursor variable, you must decide which REF CURSOR data
type to use.
The REF CURSOR data type can be selected in 3 different ways:
- By defining a specific REF CURSOR types using the TYPE ...
RETURN statement.
- By defining a generic REF CURSOR type using the TYPE ...
statement.
- By using the system defined SYS_REFCURSOR.
Also read
What a SELECT FOR UPDATE cursor represent?, What WHERE CURRENT OF
clause does in a cursor?, Can you pass a parameter to a cursor?,
Explain the functioning of CURSOR FOR LOOP with example., Define
Simple/Explicit , Parametric and Internal/Implicit
cursor.............
Normal cursors fall under the category of static cursors while
REF cursors are dynamic.........
A cursor variable works like pointer in C. It is used to hold
address of an item rather than the item itself. Cursor variables can
be used to hold different values at run time............
The CURSOR FOR UPDATE obtains a lock on a selected number of rows
that have not undergone a COMMIT yet..............
A parameter makes the cursor more reusable, A parameter avoids
scoping problems...............
|