RE: Can you use a reference cursor as an input parameter in a procedure with out declaring it explicitly?
No because an Explicit cursor is the only one we are going to create that only we can able to keep as a parameter Implicit cursor is created by the oracle server only so we can't access it
RE: Can you use a reference cursor as an input parameter in a procedure with out declaring it explicitly?
Question it self is wrong.
In cursors there are two types. 1.Implicit cursors 2. Explicit cursors Explicit cursors can be defined as dynamic (Reference ) or static. Only reference cursors can be passed as parameter - static cursor can't.
RE: Can you use a reference cursor as an input parameter in a procedure with out declaring it explicitly?
Oh sorry.
You can not declare . Here is the example PROCEDURE test_ref (emp_cur IN my_refcursor) IS emp_rec emp ROWTYPE; BEGIN LOOP FETCH emp_cur INTO emp_rec; EXIT WHEN emp_cur NOTFOUND; dbms_output.put_line(emp_rec.ename ||' is a ' || emp_rec.job); END LOOP; END;
It will throw error PLS-00201: identifier 'MY_REFCURSOR' must be declared
But you can pass it as sys_refcursor without getting any error.
CREATE OR REPLACE PROCEDURE test_ref (emp_cur IN sys_refcursor) IS emp_rec emp ROWTYPE; BEGIN LOOP FETCH emp_cur INTO emp_rec; EXIT WHEN emp_cur NOTFOUND; dbms_output.put_line(emp_rec.ename ||' is a ' || emp_rec.job); END LOOP; END;