The procedure which returns refcursor:
SQL> create or replace procedure employee_get (c_emp out sys_refcursor) is
2 begin
3 open c_emp for select empno, ename from emp;
4 end;
5 /
Procedure created.
Execution:
SQL> declare
2 c_out sys_refcursor;
3 begin
4 employee_get(c_out);
5 dmbs_sql.return_result(c_out);
6 end;
7 /
dmbs_sql.return_result(c_out);
*
ERROR at line 5:
ORA-06550: line 5, column 3:
PLS-00201: identifier 'DMBS_SQL.RETURN_RESULT' must be declared
ORA-06550: line 5, column 3:
PL/SQL: Statement ignored
See with your DBA whether you can get execute privileges on DBMS_SQL package.
If not:
SQL> var c_out refcursor;
SQL> exec employee_get(:c_out);
PL/SQL procedure successfully completed.
SQL> print :c_out
EMPNO ENAME
---------- ----------
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
7839 KING
7844 TURNER
7876 ADAMS
7900 JAMES
7902 FORD
7934 MILLER
14 rows selected.
SQL>