ITPub博客

首页 > 数据库 > Oracle > [20190603]关于dbms_output输出问题.txt

[20190603]关于dbms_output输出问题.txt

原创 Oracle 作者:lfree 时间:2019-06-06 20:45:31 0 删除 编辑

[20190603]关于dbms_output输出问题.txt

--//以前遇到的问题,重新做一个记录:
--//链接:http://www.itpub.net/thread-2096243-1-1.html

1.环境:
SYS@book> @ 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

2.测试:
SCOTT@book> set serveroutput OFF
SCOTT@book> call dbms_output.enable(1e6);
Call completed.

SCOTT@book> exec DBMS_OUTPUT.put_line ('this is a first test!');
PL/SQL procedure successfully completed.

--//现在不显示是正常的。因为设置serveroutput OFF.

SCOTT@book> set serverout on
SCOTT@book> exec DBMS_OUTPUT.put_line ('this is a second test!');
this is a first test!
this is a second test!
PL/SQL procedure successfully completed.

--//OK,现在把在缓存的第一行一起显示出来,出现了2行,主要我打开了dbms_output.enable(1e6),缺省这个是disable。再次执行就不会了。

SCOTT@book> exec DBMS_OUTPUT.put_line ('this is a third test!');
this is a third test!
PL/SQL procedure successfully completed.

--//但是如果执行set serveroutput OFF后没有执行call dbms_output.enable(1e6);缓存就关闭了.

3.继续测试:
SCOTT@book> set serverout off
SCOTT@book> exec DBMS_OUTPUT.put_line ('this is a 111 test!');
PL/SQL procedure successfully completed.

SCOTT@book> set serverout on
SCOTT@book> exec DBMS_OUTPUT.put_line ('this is a 222 test!');
this is a 222 test!
PL/SQL procedure successfully completed.

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

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

注册时间:2008-01-03

  • 博文量
    2435
  • 访问量
    6215474