Pragma is a keyword in Oracle PL/SQL that is used to provide an instruction to the compile.
Types Of Pragmas :-
1 - AUTONOMOUS_TRANSACTION
2 - EXCEPTION_INIT
3 - RESTRICT_REFERENCES
4 - SERIALLY_REUSABLE
amrapali
Apr 21st, 2012
PRAGMA
The instruction is a statement that provides some instructions to the compiler.
Pragmas are defined in the declarative section in PL/SQL.
The following pragmas are available:
AUTONOMOUS_TRANSACTION:
Prior to Oracle 8.1, each Oracle session in PL/SQL could have at most one active transaction at a given time. In other words, changes were all or nothing. Oracle8i PL/SQL addresses that short comings with the AUTONOMOUS_TRANSACTION pragma. This pragma can perform an autonomous transaction within a PL/SQL block between a BEGIN and END statement without affecting the entire transaction. For instance, if rollback or commit needs to take place within the block without effective the transaction outside the block, this type of pragma can be used.
EXCEPTION_INIT:
The most commonly used pragma, this is used to bind a user defined exception to a particular error number.
For example:
Declare I_GIVE_UP EXCEPTION;
PRAGMA EXCEPTION_INIT(I_give_up, -20000);
BEGIN .. EXCEPTION WHEN I_GIVE_UP do something.. END;
Oracle PRAGMA'S
Profile Answers by Nishant.Patel Questions by Nishant.Patel
Questions by Nishant.Patel