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

本文详细介绍了在Oracle数据库中使用DBMS_OUTPUT包的方法。包括如何启用和禁用输出,以及如何通过设置服务器输出来查看缓冲区的内容。通过具体示例,展示了不同设置下输出行为的变化。

[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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/267265/viewspace-2647020/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值