建议你多看看oracle相关的文档和书!
sqlplus使用如下:
SQL> create or replace procedure test1(rcursor out sys_refcursor) as
2 begin
3 open rcursor for
4 select decode(row_number() over(partition by deptno order by ename),
5 1,
6 deptno,
7 null) deptno,
8 t.ename
9 from scott.emp t;
10 end;
11 /
Procedure created.
SQL> var cur refcursor
SQL> exec test1(:cur);
PL/SQL procedure successfully completed.
SQL> print cur;
DEPTNO ENAME
---------- ----------
10 CLARK
KING
MILLER
20 ADAMS
FORD
JONES
SCOTT
SMITH
30 ALLEN
BLAKE
JAMES
DEPTNO ENAME
---------- ----------
MARTIN
TURNER
WARD
14 rows selected.
SQL>