set serveroutput on;
Declare
a number(4);
b number(4);
c number(4);
choice number(4);
wrong_choice exception;
Begin
a:=&a;
b:=&b;
choice:=&choice;
case choice
when 1 then
c:=a+b;
dbms_output.put_line('Addition is ' ||c);
when 2 then
c:=a-b;
dbms_output.put_line('Subtraction is ' ||c);
when 2 then
c:=a*b;
dbms_output.put_line('Multiplication is ' ||c);
when 4 then
c:=a/b;
dbms_output.put_line('Division is ' ||c);
else
raise wrong_choice;
end case;
exception
when wrong_choice then
dbms_output.put_line('Please enter valid choice');
end;
/
Declare
a number(4);
b number(4);
c number(4);
choice number(4);
wrong_choice exception;
Begin
a:=&a;
b:=&b;
choice:=&choice;
case choice
when 1 then
c:=a+b;
dbms_output.put_line('Addition is ' ||c);
when 2 then
c:=a-b;
dbms_output.put_line('Subtraction is ' ||c);
when 2 then
c:=a*b;
dbms_output.put_line('Multiplication is ' ||c);
when 4 then
c:=a/b;
dbms_output.put_line('Division is ' ||c);
else
raise wrong_choice;
end case;
exception
when wrong_choice then
dbms_output.put_line('Please enter valid choice');
end;
/
No comments:
Post a Comment