Oracle SQL/PLSQL Chapter 2: Getting started with PL/SQL

Oracle SQL/PLSQL Chapter 2: Getting started with PL/SQL

 Section 2.1: Hello World



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 the 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.

Post a Comment

0 Comments