Saturday, 17 July 2021

DBMS_OUTPUT.PUT_LINE in PL/SQL

 I will explain dbms_output.put_line in PL/SQL in this post.

DBMS_OUTPUT.PUT_LINE

 

PL/SQL has DBMS_OUTPUT package that is used to send messages from procedures, packages, and triggers. This package is used to display output to a screen.

 

PUT_LINE

DBMS_OUTPUT.PUT_LINE procedure is used to place a line in the buffer or display output to a screen.

Syntax

DBMS_OUTPUT.PUT_LINE (item IN VARCHAR2);

 

Example:

SQL> SET SERVEROUTPUT ON 
SQL> BEGIN DBMS_OUTPUT.PUT_LINE ('Hello IT Tutorial'); 
2 DBMS_LOCK.SLEEP (10); 
3 END;
4 /

Hello IT Tutorial

PL/SQL procedure successfully completed.

SQL>

dbms_output.put_line procedure trims off white space from output as follows.

SQL> 
SQL> SET SERVEROUTPUT ON
SQL> BEGIN DBMS_OUTPUT.PUT_LINE ('   Hello IT Tutorial    ');
2 END;
3 /
Hello IT Tutorial

PL/SQL procedure successfully completed.

SQL>


When your lines exceeds the line limit, you receive an error message after execution.

0 comments:

Post a Comment