First, the use of dbms_output
1. Debug code, output variables and values of expressions.
2, debugging code, output dynamic SQL splicing statements, and then run the output of the statement to debug.
3, generate reports and other functions.
Second, enable and disable the Dbms_output function
1, set serveroutput on, enable Dbms_output.
2, set Serveroutput off, disable dbms_output.
Third, set the dbms_output buffer size
1, the default value is 20000 bytes
2, set the scope of the scope of use Dbms_output. ENABLE ("New buffer Size").
3. Set this session scope using set serveroutput on size "New buffer size".
Four, dbms_output reference
Name |
Type |
Parameter list |
Parameter description |
Function description |
Dbms_output. Chararr |
TYPE |
|
|
The type of the parameter lines as the Get_lines. |
Dbms_output. ENABLE |
PROCEDURE |
Buffer_size in INTEGER DEFAULT |
Buffer_size: Buffer size, do not lose default value 20000 |
Dbms_output is enabled at the current scope, and the buffer size can be modified. |
Dbms_output. DISABLE |
PROCEDURE |
No |
|
Deactivate Dbms_output in the current scope. |
Dbms_output. PUT |
PROCEDURE |
Line in VARCHAR2 |
Line: The text to output |
Enter text into the buffer, not output. |
Dbms_output. Put_Line |
PROCEDURE |
Line in VARCHAR2 |
Line: The text to output |
Enter text and a newline character into the buffer, output all the text in the buffer, and then empty the line break. |
Dbms_output. New_line |
PROCEDURE |
No |
|
Adds a newline character to the buffer, outputs all the text in the buffer, and then empties the line break. |
Dbms_output. Get_line |
PROCEDURE |
Line out VARCHAR2, status out INTEGER |
Line: Receive text, do not include newline character parameter status:0= call succeeded, 1 = no more rows |
Extracts the first line of text from the buffer to lines and empties the buffer. |
Dbms_output. Get_lines |
PROCEDURE |
Lines out Chararr,numlines on out INTEGER |
Lines: array numlines that receives multiple lines of text: the input is the number of rows to get, and if the input and output are consistent, the call succeeds. Otherwise no more rows |
Extracts the Numlines line text from the first line in the buffer to lines and empties the buffer. |
Oracle dbms_output Package Full reference manual (Chinese version)