A cursor variable points to the current row in the result set of a
multi-row query. Cursor variables are dynamic because they are not tied
to a specific query. You can open a cursor variable for any
type-compatible query. This gives you more flexibility.
To create cursor variables, you take two steps. First, you define a REF
CURSOR type, then declare cursor variables of that type. You can define
REF CURSOR types in any PL/SQL block, subprogram, or package using the
syntax
TYPE ref_type_name IS REF CURSOR [RETURN return_type];
Once you define a REF CURSOR type, you can declare cursor variables of
that type in any PL/SQL block or subprogram. In the following example,
you declare the cursor variable pcur:
CREATE OR REPLACE PACKAGE EmpUtils AS
TYPE empcur IS REF CURSOR;
PROCEDURE GetEmpRecords(
indept IN NUMBER,
perr OUT NUMBER,
pcur OUT empcur);
END EmpUtils;
/
CREATE OR REPLACE PACKAGE BODY EmpUtils AS
PROCEDURE GetEmpRecords(
indept IN NUMBER,
perr OUT NUMBER,
pcur OUT empcur) IS
BEGIN
perr := 0;
OPEN pcur FOR
SELECT * FROM emp
WHERE deptno = indept
ORDER BY empno;
EXCEPTION
WHEN OTHERS THEN
perr:= SQLCODE;
END GetEmpRecords;
END EmpUtils;
/
essentially within your code you can then create an DataAdaptor and call
the fill method passing in a dataset.
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!