Explain user defined exceptions in oracle

Explain user defined exceptions in oracle.

User defined exception in oracle are defined by the user. They need to be explicitly raised by the user using the RAISE statement. Oracle is not aware of these exceptions unless declared.

Example:
DECLARE
      Trans EXCEPTION;
BEGIN
IF TO_CHAR(SYSDATE, ‘DY’)= ‘SUN’ THEN
RAISE Trans;
END IF
EXCEPTION
WHEN trans THEN
DBMS_OUTPUT.PUT_LINE(‘No transactions today’);
END;
How PL/SQL Exceptions Are Raised?
The PL/SQL exceptions can be raised in 4 ways. Either the user can raise them or they can be raised by the PL/SQL engine. They are as follows:....
Guidelines for Avoiding and Handling PL/SQL Errors and Exceptions
Guidelines for Avoiding and Handling PL/SQL Errors and Exceptions - Use both error checking and exception handling to ensure your program can handle all possibilities.....
Explain the types of Exceptions
Predefined oracle exceptions - These are the PL/SQL runtime engine raised named system exceptions......
Post your comment