<<Previous Next>>
Oracle - What is a package
cursor? - Feb 07, 2010 at 14:20 PM by Shuchi
Gauri
What is a package
cursor?
A Package that returns a Cursor type is a
package cursor.
Eg: Create or replace package pkg_Util
is cursor c_emp is
select * from
employee; r_emp
c_emp%ROWTYPE; end;
/*Another
package using this package*/ Create or replace package body
pkg_aDifferentUtil is procedure p_printEmps
is
begin open
pkg_Util.c_emp;
loop
fetch pkg_Util.c_emp into
pkg_Util.r_emp;
exit when
pkg_Util.c_emp%NOTFOUND;
DBMS_OUTPUT.put_line(pkg_Util.r_emp.first_Name);
end loop;
close pkg_Util.c_emp; end; end;
Oracle - What
is a package cursor? - April 10, 2009 at 11:00
AM
What is a package cursor?
In a package cursor, the SQL statement for
the cursor is attached dynamically at runtime from calling
procedures.
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.............. .
|