Exception Handling: PL/SQL Exceptions Consist Following Three
Exception Handling: PL/SQL Exceptions Consist Following Three
Exception Handling: PL/SQL Exceptions Consist Following Three
In PL/SQL , a warning or error condition is called an exception, which arises during program
execution. Runtime errors or exception arise from design faults, coding mistakes, hardware
failure and many other sources. When an error occurs, an exception is raised, i.e. the normal
execution stops and the control transfers to the exception handling part of the PL/SQL block.
Exceptions are the identifiers in PL/SQL which may be raised during the
execution of a block to terminate its main body of actions. A block will always terminate when
an exception is raised, but you may specify an ‘Exception Handler’ to perform final actions
before the block terminates.
PL/SQL exceptions consist following three,
1. Exception Type
2. Error Code
3. Error Message
TYPES OF EXCEPTION
Exceptions can be of two types :-
(1) Predefined Exception
(2) User-defined Exception
user_define_exception_name EXCEPTION
;
RAISE user_define_exception_name
;
BEGIN
EXCEPTION
WHEN user_define_exception_name THEN
Userdefined statements (action) will be taken;
END;