In the PL/SQL language the errors are called exceptions. Exceptions can be predefined exceptions (internal error) or user defined exceptions (named by user).
Predefined PL/SQL Exceptions
The predefined exceptions are internally defined exceptions that have predefined names like no_data_found, too_many_rows, others, invalid_number, zero_divide.
The predefined PL/SQL exceptions are declared globally in the package STANDARD and the system raises these exceptions implicitly (automatically).
Syntax:
declare -- pl/sql part begin -- pl/sql statement exception when exception_name then -- pl/sql exception handlers end;
User defined PL/SQL Exceptions
The user defined exceptions are user declared exceptions in the declarative part of any PL/SQL anonymous block, subprogram or package.
Syntax:
declare exception_name exception; -- named by user begin -- pl/sql statement exception when exception_name then -- pl/sql exception handlers end;