ITPub博客

首页 > Linux操作系统 > Linux操作系统 > An example of ref cursor(2)

An example of ref cursor(2)

原创 Linux操作系统 作者:dragondb 时间:2019-01-20 10:30:07 0 删除 编辑
An example of ref cursor

SQL> create or replace function f_test return sys_refcursor is
2 v_cursor sys_refcursor;
3 begin
4
5 open v_cursor for
6 select *
7 from emp;
8
9 return v_cursor;
10 end f_test;
11 /

Function created.

SQL> var cur_ref refcursor;
SQL> call f_test() into:cur_ref;

Call completed.

SQL> print cur_ref;

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
7369 SMITH CLERK 7902 1980-12-17 00:00:00 800 20
7499 ALLEN SALESMAN 7698 1981-02-20 00:00:00 1600 300 30
7521 WARD SALESMAN 7698 1981-02-22 00:00:00 1250 500 30
7566 JONES MANAGER 7839 1981-04-02 00:00:00 2975 20
7654 MARTIN SALESMAN 7698 1981-09-28 00:00:00 1250 1400 30
7698 BLAKE MANAGER 7839 1981-05-01 00:00:00 2850 30
7782 CLARK MANAGER 7839 1981-06-09 00:00:00 2450 10
7839 KING PRESIDENT 1981-11-17 00:00:00 5000 10
7844 TURNER SALESMAN 7698 1981-09-08 00:00:00 1500 0 30
7900 JAMES CLERK 7698 1981-12-03 00:00:00 950 30
7902 FORD ANALYST 7566 1981-12-03 00:00:00 3000 20

EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
7934 MILLER CLERK 7782 1982-01-23 00:00:00 1300 10

12 rows selected.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/45259/viewspace-134949/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2003-05-05

  • 博文量
    60
  • 访问量
    43181