start page | rating of books | rating of authors | reviews | copyrights

Oracle PL/SQL Programming, 2nd Edition

Oracle PL/SQL Programming, 2nd EditionSearch this book
Previous: 2.5 Comments Chapter 2
PL/SQL Language Fundamentals
Next: 2.7 Block Structure
 

2.6 The PRAGMA Keyword

The PRAGMA keyword is used to signify that the remainder of the PL/SQL statement is a pragma, or directive, to the compiler. Pragmas are processed at compile time; they do not execute during runtime.

A pragma is a special instruction to the compiler. Also called a pseudoinstruction, the pragma doesn't change the meaning of a program. It simply passes information to the compiler. It is very similar, in fact, to the tuning hints you can embed in a SQL statement inside a block comment.

PL/SQL offers the following pragmas:

EXCEPTION_INIT

Tells the compiler to associate a particular error number with an identifier you have declared as an exception in your program. See Chapter 8, Exception Handlers for more information.

RESTRICT_REFERENCES

Tells the compiler the purity level (freedom from side effects) of a packaged program. See Chapter 17, Calling PL/SQL Functions in SQL for more information.

SERIALLY_REUSABLE

New to PL/SQL8. Tells the PL/SQL runtime engine that package-level data should not persist between references to that data. See Chapter 25, Tuning PL/SQL Applications for more information.

The syntax for using the PRAGMA keyword is as follows:

PRAGMA <instruction>;

where <instruction> is a statement providing instructions to the compiler. You would call EXCEPTION_INIT as follows:

DECLARE    no_such_sequence EXCEPTION;    PRAGMA EXCEPTION_INIT (no_such_sequence, -2289); BEGIN    ... END;


Previous: 2.5 Comments Oracle PL/SQL Programming, 2nd Edition Next: 2.7 Block Structure
2.5 Comments Book Index 2.7 Block Structure

The Oracle Library Navigation

Copyright (c) 2000 O'Reilly & Associates. All rights reserved.

Library Home Oracle PL/SQL Programming, 2nd. Ed. Guide to Oracle 8i Features Oracle Built-in Packages Advanced PL/SQL Programming with Packages Oracle Web Applications Oracle PL/SQL Language Pocket Reference Oracle PL/SQL Built-ins Pocket Reference