set serveroutput on
DECLARE
message constant varchar2(32767):= 'Hello, World!';
BEGIN
dbms_output.put_line(message);
END;
/
Command set serveroutput on is required in SQL*Plus and SQL Developer clients to enable the output of dbms_output. Without the command nothing is displayed.
The end; line signals the end of the anonymous PL/SQL block. To run the code from SQL command line, you may need to type / at the beginning of the first blank line after the last line of the code. When the above code is executed at SQL prompt, it produces the following result:
Hello, World!
PL/SQL procedure successfully completed.