ITPub博客

首页 > 数据库 > Oracle > [20180109]sqlplus refcursor.txt

[20180109]sqlplus refcursor.txt

原创 Oracle 作者:lfree 时间:2018-01-10 08:43:41 0 删除 编辑

[20180109]sqlplus refcursor.txt

--//别人问的问题,如何在sqlplus使用refcursor定义的变量,我查询一下,做一个记录:

SCOTT@book> @ &r/ver1
PORT_STRING         VERSION    BANNER
------------------- ---------- ----------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SCOTT@book> var x refcursor;
SCOTT@book> exec open :x for select * from dept;

PL/SQL procedure successfully completed.

SCOTT@book> print :x
    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON

--//以前经常使用这样方式测试undo的ora-01555错误。

$ oerr ora 1555
01555, 00000, "snapshot too old: rollback segment number %s with name \"%s\" too small"
// *Cause: rollback records needed by a reader for consistent read are
//         overwritten by other writers
// *Action: If in Automatic Undo Management mode, increase undo_retention
//          setting. Otherwise, use larger rollback segments

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

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7969645