Google Search

Wednesday, October 12, 2011

Write a PL/SQL program to find the largest of three numbers


Write a PL/SQL program to find the largest of three numbers
declare
a number;
b number;
c number;
begin
a:=&a;
b:=&b;
c:=&c;
if a=b and b=c and c=a then
dbms_output.put_line('ALL ARE EQUAL');
elsif a>b and a>c then
             dbms_output.put_line('A IS GREATER');
         elsif b>c then
                dbms_output.put_line('B IS GREATER');
  else
                dbms_output.put_line('C IS GREATER');
end if;
end;
/
OUTPUT:
SQL> @ GREATESTOF3.sql
Enter value for a: 8
old   6: a:=&a;
new   6: a:=8;
Enter value for b: 9
old   7: b:=&b;
new   7: b:=9;
Enter value for c: 7
old   8: c:=&c;
new   8: c:=7;
B IS GREATER
PL/SQL procedure successfully completed.

1 comments:

sanjay varma said...

Appreciation for nice Updates, I found something new and folks can get useful info about BEST ONLINE TRAINING

Post a Comment