Hello World program in oracle sql

Hello World program in oracle sql

It is quite weird but yes you can make hello world program in oracle sql  with the help of  dbms_output.put_line() function writing between begin and END keyword as shown below.

begin
dbms_output.put_line('Hello World!!');
end;


Output:
"Hello World!!"




Program of addition, subtraction, division and multiplication in oracle 10g

Here the program can be divided into two part declaration and definition.
Declaration section consist of DECLARE keyword followed by variable to be used.
Definition section starts with  BEGIN  keyword which consist of definition or the operation to be performed.


The program is terminated using END keyword followed by  backslash ( / )  which tell about the termination of the program.

DECLARE 
   a integer := 10;
   b integer := 5;
   c integer;
   d integer;
   e integer;
   f  real;
BEGIN
  c:=a+b;
  dbms_output.put_line('sum='||c);
  d=:a-b;
  dbms_output.put_line('subtraction='||d);
  e:=a*b;
  dbms_output.put_line('multiplication='||e);
  f:=a/b;
  dbms_output.put_line('divide='||f);
END;
/

Output:

sum=15
subtraction=5
multiplication=50
divide=2


Statement processed.
0.19 seconds

I  hope you have understood  .However if you have any doubt comment below in comment section.

Comments

Popular posts from this blog

Error http://172.0.0.1:8080/apex application not found in oracle 10g Solved

Sequence diagram of Airport Check-in and Sreening System in uml