[20190603]關於dbms_output輸出問題.txt

lfree發表於2019-06-06

[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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章