RESTRICT_REFERENCES Pragma
===========================
This pragma was used to assert to the PL/SQL compiler the purity level of a packaged procedure or function. The RESTRICT_REFERENCES pragma had to be included in the package specification if you were to use that program inside a SQL statement (directly or indirectly).
This is not required starting with Oracle8i.
This pragma confirms to Oracle database that the function as the specified side-effects or ensures that it lacks any such side-effects.
Usage is as follows:
PRAGMA RESTRICT_REFERENCES(function_name, WNDS [, WNPS] [, RNDS], [, RNPS])
WNDS: Writes No Database State. States that the function will not perform any DMLs.
WNPS: Writes No Package State. States that the function will not modify any Package variables.
RNDS: Reads No Database State. Analogous to Write. This pragma affirms that the function will not read any database tables.
RNPS: Reads No Package State. Analogous to Write. This pragma affirms that the function will not read any package variables.
You can declare the pragma RESTRICT_REFERENCES only in a package spec or object type spec. You can specify up to four constraints (RNDS, RNPS, WNDS, WNPS) in any order. To call the function from parallel queries, you must specify all four constraints. No constraint implies another. For example, WNPS does not imply RNPS.
When you specify TRUST, the function body is not checked for violations of the constraints listed in the pragma. The function is trusted not to violate them.
If you specify DEFAULT instead of a function name, the pragma applies to all functions in the package spec or object type spec (including, in the latter case, the system-defined constructor). You can still declare the pragma for individual functions. Such pragmas override the default pragma.
A RESTRICT_REFERENCES pragma can apply to only one function declaration. So, a pragma that references the name of overloaded functions always applies to the nearest foregoing function declaration.
syntax
========
-
PRAGMA RESTRICT_REFERENCES (
-
function_name, WNDS [, WNPS] [, RNDS] [, RNPS] [, TRUST] );
-
In the following example, the pragma applies to the second declaration of isok:
-
CREATE PACKAGE showrec AS
-
FUNCTION isok (amount NUMBER) RETURN BOOLEAN;
-
FUNCTION isok (net_time DATE) RETURN BOOLEAN;
-
PRAGMA RESTRICT_REFERENCES (isok, WNDS);
-
...
-
END showrec;
-
DEFAULT
----------------
This specifies that the pragma applies to all functions in the package spec or object type spec. You can still declare the pragma for individual functions. Such pragmas override the default pragma.