PLSQL: EXCEPTION HANDLING: BASICS, EXCEPTION VARIABLES, RAISE_APPLICATION_ERROR, USER DEFINED EXCEPTION, RE-RAISE EXCEPTION

27 programming challenges to help you master the fundamentals of DATABASE MANAGEMENT SYSTEM USING ORACLE.

1

Write a PL/SQL block to handle NO_DATA_FOUND exception while fetching employee details.

(Exception Basics)

2

Write a PL/SQL block to handle TOO_MANY_ROWS exception.

(Exception Basics)

3

Write a PL/SQL block to handle ZERO_DIVIDE exception.

(Exception Basics)

4

Write a PL/SQL block to handle VALUE_ERROR exception.

(Exception Basics)

5

Write a PL/SQL block with a generic WHEN OTHERS exception handler.

(Exception Basics)

6

Write a PL/SQL block to display error code and message using SQLCODE and SQLERRM.

(Exception Variables)

7

Write a PL/SQL block to capture and display error details when division by zero occurs.

(SQLCODE, SQLERRM)

8

Write a PL/SQL block to log exception message into a variable and display it.

(Exception Variables)

9

Write a PL/SQL block to raise an error if salary is less than 2000 using RAISE_APPLICATION_ERROR.

(RAISE_APPLICATION_ERROR)

10

Write a PL/SQL block to validate employee age and raise custom error if age < 18.

(RAISE_APPLICATION_ERROR)

11

Write a PL/SQL block to restrict update operation using RAISE_APPLICATION_ERROR.

(Business Rule Validation)

12

Write a PL/SQL block to raise an error when invalid department number is entered.

(Validation Logic)

13

Write a PL/SQL block to declare and handle a user-defined exception.

(User Defined Exception)

14

Write a PL/SQL block to raise a custom exception when salary exceeds limit.

(User Defined Exception)

15

Write a PL/SQL block to validate input and raise user-defined exception for invalid data.

(Custom Validation)

16

Write a PL/SQL block to handle multiple user-defined exceptions.

(Multiple Exceptions)

17

Write a PL/SQL block to catch an exception and re-raise it using RAISE.

(Re-raise Exception)

18

Write a PL/SQL block where exception is handled in inner block and re-raised to outer block.

(Nested Blocks + Re-raise)

19

Write a PL/SQL block to log error and then re-raise it.

(Logging + Re-raise)

20

Write a PL/SQL block to fetch employee details and handle all possible exceptions.

(Combined Exception Handling)

21

Write a PL/SQL block using user-defined exception and RAISE_APPLICATION_ERROR together.

(Combined Concepts)

22

Write a PL/SQL block to validate salary and raise appropriate exception.

(Validation + Exception)

23

Write a PL/SQL block to perform division and handle exception using SQLCODE & SQLERRM.

(Combined Concepts)

24

Write a PL/SQL block to simulate bank withdrawal with exception handling.

25

Write a PL/SQL block to validate employee data and raise different exceptions for different errors.

(Multiple Exception Handling)

26

Write a PL/SQL block to log errors into a table using exception handling.

(Logging Errors)

27

Write a PL/SQL block to implement nested exception blocks with re-raise mechanism.

(Advanced Exception Handling)