What is PRAGMA keyword in Oracle PL/SQL?

Oracle Apps Interview QuestionsCategory: PL/SQLWhat is PRAGMA keyword in Oracle PL/SQL?
Questions Master asked 3 years ago
1 Answers
Shailender Thallam Staff answered 3 years ago

In Oracle PL/SQL,
1. PRAGMA refers to a compiler directive or “hint” it is used to provide an instruction to the compiler.
2. The directive restricts member subprograms to query or modify database tables and packaged variables.
3. Pragma directives are processed at compile time where they pass necessary information to the compiler;
4. Pragma directives are NOT processed at runtime.
Below are the types of PRAGMAs in Oracle PL/SQL:
AUTONOMOUS_TRANSACTION – Compiler allows schema objects like subprograms, PL/SQL blocks, or triggers to commit their transaction within their scope.
RESTRICT_REFERENCES – Allows the compiler to scan the database purity during package compilation. It can be used in packages only.
EXCEPTION_INIT – Compiler associates a user defined exception name with an exception number.
SERIALLY_REUSABLE – Compiler deduces the package state from session level to just a server call. It can be used in Package spec only.
PRAGMA INLINE – New member of oracle pragma family. It is used to explicitly inline a program unit.