[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.