PL/SQL: DBMS Output Cheat Sheet

Display all the user tables in the database:

BEGIN 
   dbms_output.put_line  (user || ' Tables in the database:'); 
   FOR t IN (SELECT table_name FROM user_tables) 
   LOOP 
      dbms_output.put_line(t.table_name); 
   END LOOP; 
END; 
/ 

DBMS_OUTPUT Subprograms

DBMS_OUTPUT.DISABLE;Disables message output.
DBMS_OUTPUT.ENABLE(buffer_size IN INTEGER DEFAULT 20000);Enables message output. A NULL value of buffer_size represents unlimited buffer size.
DBMS_OUTPUT.GET_LINE (line OUT VARCHAR2, status OUT INTEGER);Retrieves a single line of buffered information.
DBMS_OUTPUT.GET_LINES (lines OUT CHARARR, numlines IN OUT INTEGER);Retrieves an array of lines from the buffer.
DBMS_OUTPUT.NEW_LINE;Puts an end-of-line marker.
DBMS_OUTPUT.PUT(item IN VARCHAR2);Places a partial line in the buffer.
DBMS_OUTPUT.PUT_LINE(item IN VARCHAR2);Places a line in the buffer.

Leave a Reply

Your email address will not be published. Required fields are marked *