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

652

被折叠的 条评论
为什么被折叠?



