LZ, 你调用出错, 如下是一个类似的例子,当然,你也可以使用PL/SQL代码来实现调用!
SQL> create or replace package mypackage1 as
2
3 type cursorType is ref cursor;
4
5 procedure getAuditrolestechs(v_formtoauditingoid in emp.deptno%type,
6 c_cursor out mypackage1.cursorType);
7 end mypackage1;
8 /
Package created.
SQL>
SQL>
SQL> create or replace package body mypackage1 as
2
3 procedure getAuditrolestechs(v_formtoauditingoid emp.deptno%type,
4 c_cursor out mypackage1.cursorType) as
5 begin
6 open c_cursor for
7 SELECT *
8 FROM emp
9 WHERE deptno = v_formtoauditingoid;
10 end getAuditrolestechs;
11 end mypackage1;
12 /
Package body created.
SQL> var cur refcursor;
SQL> exec mypackage1.getAuditrolestechs(20, :cur);
PL/SQL procedure successfully completed.
SQL> print cur;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 800 20
7566 JONES MANAGER 7839 02-APR-81 2975 20
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7902 FORD ANALYST 7566 03-DEC-81 3000 20
SQL>