Program which handles Multiple errors in the same program. Roll no --- 06.
declare a number(3); b number(3); c number(4,2); lowval exception; greatval exception; begin a:=&a; b:=&b; if a<0 or b<0 then raise lowval; end if; if b>a then raise greatval; end if; c:=a/b; dbms_output.put_line('a/b='||c); exception when greatval then dbms_output.put_line('Enter value for b such that a>b'); when lowval then dbms_output.put_line('Enter possitive values'); when value_error then dbms_output.put_line('Enter three digit number'); when zero_divide then dbms_output.put_line('Divide by zero error'); when others then dbms_output.put_line('Error occured'); end; output: 1] Enter value for a: 333 old 8: a:=&a; new 8: a:=333; Enter value for b: 333 old 9: b:=&b; new 9: b:=333; a/b=1 PL/SQL procedure successfully completed.
2] Enter value for a: 4444 old 8: a:=&a; new 8: a:=4444; Enter value for b: 4444 old 9: b:=&b; new 9: b:=4444; Enter three digit number PL/SQL procedure successfully completed. 3] Enter value for a: 222 old 8: a:=&a; new 8: a:=222; Enter value for b: 444 old 9: b:=&b; new 9: b:=444; Enter value for b such that a>b PL/SQL procedure successfully completed. 4] Enter value for a: 0 old 8: a:=&a; new 8: a:=0; Enter value for b: 0 old 9: b:=&b; new 9: b:=0; Divide by zero error PL/SQL procedure successfully completed. 5] Enter value for a: -1 old 8: a:=&a; new 8: a:=-1; Enter value for b: -5 old 9: b:=&b; new 9: b:=-5; Enter possitive values PL/SQL procedure successfully completed.