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:
And I get no output in the Output tab (regardless of whether I have the set serveroutput on
):
How can I see the output sent to dbms_output.put_line('hello') in a script run in an SQL Window?
Thank you.
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.
(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.