PL/SQL - SPLessons

PL/SQL DBMS Output

Chapter 30

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

PL/SQL DBMS Output

PL/SQL DBMS Output

shape Description

PLSQL DBMS Output allows packages to dispatch the directives from triggers, packages and stored procedures.The package is helpful for showing the PL/SQL debugging instructions. 

DBMS_OUTPUT Sub-programs

shape Description

The DBMS_OUTPUT packages contains the accompanying subprograms.

S.NO Subprogram Explanation
1 DBMS_OUTPUT.DISABLE; Output message will be disabled
2 DBMS_OUTPUT.GET_LINE(line OUT VARCHAR2, STATUS OUT INTEGER); Recovers a solitary line of cushioned data.
3 DBMS_OUTPUT.ENABLE(buffer_size IN INTEGER DEFAULT 20000); Output message will be enabled.
4 DBMS_OUTPUT.GET_LINE(lines OUT CHARARR, numlines IN OUT INTEGER); Recovers an array of line from the buffer.
5 DBMS_OUTPUT.PUT(item IN VARCHAR2); Inserts an incomplete line in the cushion.
6 DBMS_OUTPUT.NEW_LINE; Puts an end-of-line marker.
7 DBMS_OUTPUT.PUT_LINE(item IN VA1RCHAR2); Adjusts a line in the buffer.

shape Examples

The below example describes the PLSQL DBMS Output program.

SQL> declare
  2  line dbms_output.chararr;
  3  num_line number;
  4  begin
  5   -- enable the buffer with default size 30000
  6  dbms_output.enable;
  7  dbms_output.put_line('Hi Everyone!');
  8  dbms_output.put_line('We hope you enjoyed the splessons tutorials!');
  9  dbms_output.put_line('Have a great time exploring pl/sql!');
 10  num_lines:=3;
 11  dbms_output.get_lines(lines,num_line);
 12  FOR i IN 1.. num_lines LOOP
 13  dbms_output.put_line(lines(i));
 14   END LOOP;
 15  END;
 16  /
Hi Everyone!
We hope you have enjoyed the splessons tutorials!
Have a great time exploring pl/sql!
PL/SQL Procedure successfully completed.

The above example displays the message and other details.

Summary

shape Key Points

  • PLSQL DBMS Output – Allows packages to deliver the directives.
  • DBMS_OUTPUT subprograms – Contains the package with required subprograms.