Exceptions:
This lesson deals with handling run-time errors which are raised due to several reasons and to provide an understandable user-friendly message. For Creating and showing user-defined error messages are also dealt with.
- Introduction to Exception
- Predefined exception
- List of Predefined exceptions
- Handling user-defined exceptions
- Using Raise_application_error
- Usage of SQLCODE and SQLERRM
Exceptions are an identifier in PL/SQL, raised in during the execution of a block which terminates its main body of actions. The block always terminates when PL/SQL raises an exception but you denote an exception handler to perform last actions.
Two techniques for raising an exception are given below:
1. An oracle error occurs and the related exception is raised automatically. For instance, if the error ORA-04103 occurs when no rows are retrieved from the database in a select statement and then PL/SQL raises the exception NO_DATA_FOUND.
2. You raise an exception explicitly through issuing the RAISE statement inside the block. The exception being raised might be either user predefined or defined.