Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable DBMS_OUTPUT in SQL Developer? [duplicate]

output for below code

DECLARE

a int;

b int;

c int;

BEGIN

a:=&a;

b:=&b;

c:=a+b;

dbms_output.put_line('Sum of a and b is '||c);

end;

/
like image 543
Prabhakar Kumar Jha Avatar asked Mar 10 '26 22:03

Prabhakar Kumar Jha


1 Answers

In SQL Developer you have to

  1. Show the DBMS_OUTPUT pane using View > DBMS_OUTPUT.

enter image description here

  1. Enable it by pressing the green "+" symbol in the output pane.

enter image description here

For more details including how to have dbms_output enabled by default for all sessions, see www.thatjeffsmith.com/archive/2012/05/enabling-dbms_output-by-default-in-sql-developer

Step by step instructions from Jeff Smith's post:

  • Open a new worksheet.
  • Code this line:
    set serverout on
  • Save to 'startup.sql' in some convenient folder
  • Open Tools > Preferences
  • Go to the Database page
  • On the 'Filename for connection startup script' – point to the 'startup.sql' file you just created.
  • Restart SQL Developer.
  • Open a connection and run your code.
like image 185
William Robertson Avatar answered Mar 16 '26 07:03

William Robertson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!