-- 进入cmd,执行类似于下面的操作:
C:\Documents and Settings\Administrator>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 4月 21 10:18:45 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
idle> conn eygle/eygle
已连接。
eygle@SZTYORA> create or replace procedure emp_proc(emp_cur out sys_refcursor)
2 as
3 begin
4 open emp_cur for SELECT * FROM EMP;
5 end;
6 /
过程已创建。
eygle@SZTYORA>
eygle@SZTYORA> var v_emp refcursor;
eygle@SZTYORA> exec emp_proc(:v_emp);
PL/SQL 过程已成功完成。
eygle@SZTYORA> print v_emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO LOC
---------- -------------------- ------------------ ---------- ------------------- ---------- ---------- ---------- --------------------------
7499 ALLEN SALESMAN 7698 1981-02-20 00:00:00 1600 300 30 CHICAGO
7521 WARD SALESMAN 7698 1981-02-22 00:00:00 1250 500 30 CHICAGO
7654 MARTIN SALESMAN 7698 1981-09-28 00:00:00 1250 400 30 CHICAGO
7844 TURNER SALESMAN 7698 1981-09-08 00:00:00 1500 0 30 CHICAGO
eygle@SZTYORA>