Download PL/SQL User's Guide and Reference

Transcript
OPEN-FOR-USING Statement
Example
In the following example, we declare a cursor variable, then associate it with a
dynamic SELECT statement that returns rows from the emp table:
DECLARE
TYPE EmpCurTyp IS REF CURSOR; -- define weak REF CURSOR type
emp_cv
EmpCurTyp; -- declare cursor variable
my_ename VARCHAR2(15);
my_sal
NUMBER := 1000;
BEGIN
OPEN emp_cv FOR -- open cursor variable
’SELECT ename, sal FROM emp WHERE sal > :s’ USING my_sal;
...
END;
Related Topics
EXECUTE IMMEDIATE Statement
13-138
PL/SQL User’s Guide and Reference