Display records using Sys_Refcursor
Hi All,
I have a function returns results set i.e. sys_refcursor
CREATE OR REPLACE
FUNCTION fn_emp RETURN SYS_REFCURSOR
AS
lc_Cursor SYS_REFCURSOR;
BEGIN
OPEN lc_Cursor FOR
SELECT empno,
ename,
sal,
deptno
FROM emp;
RETURN lc_Cursor;
END fn_emp;
Here is procedure wants to display records using sys_refcursor(Through procedure only)
CREATE OR REPLACE
PROCEDURE test831
AS
lc_cur SYS_REFCURSOR;
BEGIN
lc_cur := fn_emp ;
FOR i IN lc_cur
LOOP
DBMS_OUTPUT.PUT_LINE('i.empno');
DBMS_OUTPUT.PUT_LINE('i.ename');
END LOOP;
END test831;
but the procedure is not compiled.
Can you please check and solve the this requirement.
Advance thanks .