Tuesday, June 27, 2017

Program1- Write a program to print the Hello Message to the terminal

Solution-often we start writing the first program as hello Message.

So let us write the first hello program using various methods.

Method-1:Using Anonymous block Code- SQL> begin 2 dbms_output.put_line('HELLO'); 3 end; 4 / HELLO PL/SQL procedure successfully completed. SQL> Method-2:Using PROCEDURE code- SQL> SET SERVEROUTPUT ON SQL> CREATE OR REPLACE PROCEDURE hello 2 AS 3 BEGIN 4 dbms_output.put_line('Hello World!'); 5 END; 6 / Procedure created. SQL> Note- we can execute the procedure in two way - Use SET SERVEROUTPUT ON command to view the output on terminal- 1. SQL> EXECUTE hello; Hello World! PL/SQL procedure successfully completed. SQL> 2. SQL> BEGIN 2 hello; 3 END; 4 / Hello World! PL/SQL procedure successfully completed. SQL>

1 comment:

  1. It is good idea to write code using various approaches/technique etc

    ReplyDelete