user1817081 user1817081 - 4 months ago 22
SQL Question

Why no output when PLSQL Anonymous block completes?

I'm just getting into PL/SQL, and I tried to run the following code, and I am getting anonymous block completed, but I think I should be getting Testing output. Does any know what I am doing wrong?

DECLARE
message varchar2(20) := 'Testing output';
BEGIN
dbms_output.put_line(message);
END;
/

Answer

Viewing the DBMS_OUTPUT depends on the program.

SQL*Plus and Oracle SQL Developer

Run SET SERVEROUTPUT ON; first. This is all that's necessary in SQL*Plus or recent versions of Oracle SQL Developer.

SET SERVEROUTPUT ON;
begin
    dbms_output.put_line('Testing output');
end;
/

PL/SQL Developer

Output is automatically detected and displayed in the "Output" tab.

Comments