Wednesday, February 4, 2015

How to display output using DBMS_OUTPUT.PUT_LINE() in SQL Developer

This was a problem I have faced sometimes back, where I wanted to display output messages from the DBMS_OUTPUT.PUT_LINE() function, when I executing a PLSQL function using the SQL Developer. 

The line I used is as follows,

DBMS_OUTPUT.PUT_LINE('An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);

Once I called the function no output displayed anywhere in the SQLDeveloper. I was thinking what happened to the output. But I wanted to see the output so badly. So I searched for that and found the solution for that. So I am sharing it with you all.:)

1. Step: You have to 'Enable' the "Dbms output" functionality in the SQLDeveloper. 
Select View -> Dbms Output, click 'Enable'.


Now you can see the Dbms Output is enabled as follows.


2. Step: Run the script and see the output. :)

And also this panel gives you the chance of changing the buffer size. The default buffer size is 20000 characters and you can increase it. 

Hope this will help anyone who are wondering about what happened to the output line you put in 
DBMS_OUTPUT.PUT_LINE("You just wait output. I can see you now :D :D!!! ")

cheers !!
'do good and good will come to you'



No comments: