The DBMS_OUTPUT package contains several useful procedures. By far, the most widely used is PUT_LINE.You can use the DBMS_OUTPUT.PUT_LINE procedure to display the contents of a stored variable or any arbitrary text.
Before any lines of output will be displayed in SQL*Plus, you must first tell SQL*Plus to display server output by issuing this command:SET SERVEROUTPUT ON;
Once issued, any lines of output created by DBMS_OUTPUT.PUT_LINE will be displayed. In a similar fashion, the interpreter will no longer display output once the following command is issued:SET SERVEROUTPUT OFF;
One important note to remember is that if you plan to print many lines, it may be a good idea to resize the print buffer.
When SET SERVEROUTPUT ON is issued, then the default buffer size is 20,000 bytes.
Any content that surpasses that size will be cut off. To increase the buffer, simply set the size of buffer you'd like to use when turning the SERVEROUTPUT on.SET SERVEROUTPUT ON SIZE 1000000;
The DBMS_OUTPUT package also has a buffer size limit. The buffer can be set from 2,000 to 1,000,000 bytes in size. The buffer can be set by passing the size to DBMS_ENABLE. If you attempt to exceed the size,then an Oracle exception will be raised.
Jay on Oct 21, 2019 at 12:10 am
This article is contributed by Jay. If you like dEexams.com and would like to contribute, you can write your article here or mail your article to email@example.com . See your article appearing on the dEexams.com main page and help others to learn.