|Oracle® Database PL/SQL Language Reference
11g Release 2 (11.2)
|PDF · Mobi · ePub|
RESTRICT_REFERENCESpragma is deprecated. Oracle recommends using
PARALLEL_ENABLE(explained in "Function Declaration and Definition") instead of
RESTRICT_REFERENCES pragma asserts that a user-defined subprogram does not read or write database tables or package variables. Subprograms that read or write database tables or package variables are difficult to optimize, because any invocation of the subprogram might produce different results or encounter errors.
This pragma can appear only in a package specification or ADT specification. Typically, this pragma is specified for functions. If a function invokes procedures, specify this pragma for those procedures also.
Name of a user-defined subprogram, typically a function. If
subprogram is overloaded, the pragma applies only to the most recent subprogram declaration.
Applies the pragma to all subprograms in the package specification or ADT specification (including the system-defined constructor for ADTs).
If you also declare the pragma for an individual subprogram, it overrides the
DEFAULT pragma for that subprogram.
Asserts that the subprogram reads no database state (does not query database tables).
Asserts that the subprogram writes no database state (does not modify tables).
Asserts that the subprogram reads no package state (does not reference the values of package variables)
Asserts that the subprogram writes no package state (does not change the values of package variables).
Asserts that the subprogram can be trusted not to violate one or more rules.
When you specify
TRUST, PL/SQL does not check the subprogram body for violations of the constraints listed in the pragma. Skipping these checks can improve performance.
TRUST is needed for functions written in C or Java that are invoked from PL/SQL, since PL/SQL cannot verify them at run time.
Note:To invoke a subprogram from parallel queries, you must specify all four constraints—
WNPS. No constraint implies another.