Pragma Restrict Reference:
----------------------------------
----------------------------------
- The RESTRICT_REFERENCES pragma asserts that a user defined sub program does not read or write database tables or package variables.
- Sub programs that read or write database tables or package variables are difficult to optimize, because any call to the sub program might produce different results or encounter errors.
- To restrict these unexpected results we use pragma RESTRICT_REFERENCES.
PRAGMA:
--------------
signifies that the statement is pragma ( compiler directive). pragmas are processed at compile time, not at run time. they pass information to the compiler at compile time.
Syntax for PRAGMA RESTRICT_REFERENCES:
Syntax for PRAGMA RESTRICT_REFERENCES:
Sub program name:
------------------------
The name of user defined sub program, usually a function. if sub program name is over loaded, the pragma applies only to the most recent sub program declaration.
Default:
----------
------------------------
The name of user defined sub program, usually a function. if sub program name is over loaded, the pragma applies only to the most recent sub program declaration.
Default:
----------
Specifies that the pragma applies to all sub programs in the package specification or object type specification. (including the system defined construct for object types).
you can still declare the pragma for individual subprograms, overriding the default pragma.
RNDS:
--------- Asserts that the sub program reads no database state (doesn't query database tables).
WNDS:
----------
Asserts that the sub program writes no database state (doesn't modify database tables).
RNPS:
---------
Asserts that the sub program reads no PACKAGE state (doesn't reference the value of the package variables).
you can not specify RNPS, if the sub program invokes the SQLCODE OR SQLERRM function.
WNPS:
----------
Asserts that the sub program writes no PACKAGE state (doesn't change the value of the package variables).
you can not specify RNPS, if the sub program invokes the SQLCODE OR SQLERRM function.
TRUST:
-----------
Asserts that the sub program can be trusted not to voilate one or more rules.
when you specify TRUST, the sub program body is not checked for violations of the constraints listed in the pragma. The suprogram is trusted not to voilate them skipping these checks improves the performance.
TRUST is needed for functions written in c, java that are invoked from the plsql, since plsql can't verify them at run time.
you can still declare the pragma for individual subprograms, overriding the default pragma.
RNDS:
--------- Asserts that the sub program reads no database state (doesn't query database tables).
WNDS:
----------
Asserts that the sub program writes no database state (doesn't modify database tables).
RNPS:
---------
Asserts that the sub program reads no PACKAGE state (doesn't reference the value of the package variables).
you can not specify RNPS, if the sub program invokes the SQLCODE OR SQLERRM function.
WNPS:
----------
Asserts that the sub program writes no PACKAGE state (doesn't change the value of the package variables).
you can not specify RNPS, if the sub program invokes the SQLCODE OR SQLERRM function.
TRUST:
-----------
Asserts that the sub program can be trusted not to voilate one or more rules.
when you specify TRUST, the sub program body is not checked for violations of the constraints listed in the pragma. The suprogram is trusted not to voilate them skipping these checks improves the performance.
TRUST is needed for functions written in c, java that are invoked from the plsql, since plsql can't verify them at run time.