In this Video, I have explained PRAGMA EXCEPTION_INIT user defined exception in oracle plsql with example.
What is PRAGMA EXCEPTION_INIT
Unnamed System Exceptions: Those System Exceptions for which Oracle does not provide a name is known as Unnamed System Exception.
There are two ways to handle them :
By using WHEN OTHERS Exception Handler
By associating the Exception Code to a name using it as named exception.
We can assign a name to unnamed system exceptions using PRAGMA called EXCEPTION_INIT.
To handle error conditions (typically ORA- messages) that have no predefined name, you must use the OTHERS handler or the pragma EXCEPTION_INIT.
You can use EXCEPTION_INIT in the declarative part of any PL/SQL block, subprogram, or package.
The pragma must appear in the same declarative part as its associated exception, somewhere after the exception declaration.
Syntax of PRAGMA EXCEPTION_INIT
PRAGMA EXCEPTION_INIT(exception_name, -error_number);
Exception_name: A user-defined exception declared within the current scope.
error_number: Any valid Oracle error number. These are the same error numbers (always negative) returned by the function SQLCODE.
Some other Video related to PL SQL tutorial.
Oracle PLSQL Tutorial 34- RAISE_APPLICATION_ERROR with Example in PLSQL
• Oracle PLSQL Tutorial 34- RAISE_APPLICATIO...
Oracle PLSQL Tutorial 33- User Defined Exception with Example in PLSQL
• Oracle PLSQL Tutorial 33- User Defined Exc...
Oracle PL/SQL Tutorial 32- Exception Handling with Example in PLSQL
• Oracle PLSQL Tutorial 32- Exception Handli...
Oracle PL/SQL Tutorial 31- Parameter Modes in Procedure(IN,OUT,INOUT) with Example
• Oracle PL/SQL Tutorial 31-Parameter Modes ...
Oracle PL/SQL Tutorial 30- Stored Procedure in PLSQL with Example
• Oracle PL/SQL Tutorial 30- Stored Procedur...
Oracle PL/SQL Tutorial 29- Function INOUT Parameter in PLSQL with Example
• Oracle PL/SQL Tutorial 29- Function INOUT ...
--------------------------------------------------------------------------------------------------------
Our Social Link:-
Link (Blogger) :
https://javainhand.com
Link (Facebook Group )
https://www.facebook.com/groups/14521...
Link (Facebook Page)
/ javainhand2017