Jul 23, 2009

Conversion of Oracle REF CURSOR used as OUTPUT Parameter | DB Best blog : oracle 11

create or replace
PROCEDURE testing
(
emp_refcur OUT SYS_REFCURSOR
)
IS
pn_dept VARCHAR(6);
sql_stmt VARCHAR(256);
BEGIN
pn_dept:='456';
sql_stmt :='SELECT ' || pn_dept || ' emp_code FROM dual' ;
OPEN emp_refcur FOR sql_stmt;
END testing;

and run this by

VARIABLE resultSet REFCURSOR
EXEC p_cursor_proc( :resultSet );
PRINT :resultSet

Conversion of Oracle REF CURSOR used as OUTPUT Parameter | DB Best blog