Sunteți pe pagina 1din 2

Setting SERVEROUTPUT in Oracle

By default, SQL*PLUS doesn't read what a PL/SQL program has written with DBMS_OUTPUT. With set serveroutput on, this behavior is changed.

Note: The size unlimited clause comes with Oracle 10g Release 2.
OFF suppresses the output of DBMS_OUTPUT.PUT_LINE. ON displays the output. ON uses the SIZE and FORMAT of the previous SET SERVEROUTPUT ON SIZE n FORMAT f, or uses default values if no SET SERVEROUTPUT command was previously issued in the current connection. SIZE sets the number of bytes of the output that can be buffered within the Oracle Database server. The default is UNLIMITED. n cannot be less than 2000 or greater than 1,000,000. In iSQL*Plus you can enter the word UNLIMITED in the Size field.

Resources are not pre-allocated when SERVEROUTPUT is set. As there is no performance penalty, use UNLIMITED unless you want to conserve physical memory.

Every server output line begins on a new output line.

When WRAPPED is enabled SQL*Plus wraps the server output within the line size specified by SET LINESIZE, beginning new lines when required.

When WORD_WRAPPED is enabled, each line of server output is wrapped within the line size specified by SET LINESIZE. Lines are broken on word boundaries. SQL*Plus left justifies each line, skipping all leading whitespace. When TRUNCATED is enabled, each line of server output is truncated to the line size specified by SET LINESIZE.

Example:
SQL> SHOW SERVEROUTPUT; SQL> SET SERVEROUTPUT ON; SQL> SET SERVEROUTPUT OFF; SQL> SET SERVEROUTPUT ON SIZE 4000; SQL> SET SERVEROUTPUT ON SIZE UNLIMITED; SQL> SET SERVEROUTPUT ON FORMAT WRAPPED; SQL> SET SERVEROUTPUT ON FORMAT WORD_WRAPPED; SQL> SET SERVEROUTPUT ON FORMAT TRUNCATED;

S-ar putea să vă placă și