2

I'm not able to see the messages added to dbms_output.put_line() in PL/SQL Developer. Every google hit I see says to use set serveroutput on but this isn't working.

I try to run this script in a SQL Window:

set serveroutput on;

BEGIN
    dbms_output.put_line('hello')
END

But I get an error on the set serveroutput on line:

enter image description here

And I get no output in the Output tab (regardless of whether I have the set serveroutput on):

enter image description here

How can I see the output sent to dbms_output.put_line('hello') in a script run in an SQL Window?

Thank you.

1 Answer 1

2

That is because in PL/SQL Developer, a SQL Window can only contain either SQL or PL/SQL blocks. There is a checkbox for enabling or disabling dbms_output. SQL windows aren't really for scripts, unless the 'script' is a set of SQL queries or PL/SQL blocks and nothing else.

enter image description here

PL/SQL Developer SQL Window screenshot - output

(If there is more than one statement in the window, it may be helpful to add / as a terminator after the PL/SQL block, otherwise PL/SQL Developer won't know where one statement ends and the next begins unless you explicitly highlight it with the mouse.)

Alternatively, you could use set serverout on in a Command window (which is a SQL*Plus emulator), or better, use a Test window, which is specifically designed for executing PL/SQL blocks.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your answer William. That certainly helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.