0% found this document useful (0 votes)
36 views2 pages

Multiple Errors List No 24

This program handles multiple errors in PL/SQL by defining custom exceptions, validating input values, and printing error messages for different exception types. It demonstrates raising and catching exceptions for negative numbers, values where a is not greater than b, non-three digit numbers, divide by zero, and any other errors. The user is prompted to input values for variables a and b, which are then validated and an error message printed if an exception occurs.

Uploaded by

virusyadav
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views2 pages

Multiple Errors List No 24

This program handles multiple errors in PL/SQL by defining custom exceptions, validating input values, and printing error messages for different exception types. It demonstrates raising and catching exceptions for negative numbers, values where a is not greater than b, non-three digit numbers, divide by zero, and any other errors. The user is prompted to input values for variables a and b, which are then validated and an error message printed if an exception occurs.

Uploaded by

virusyadav
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

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.

You might also like