Introduction
In my packages functions and procedure, sometimes I have some rules to control purity rules in my database like reading from tables only, not query the database, ...... etc
So I will use
PRAGMA RESTRICT_REFERENCES to control and preserve the database state in database packages.
Syntax of PRAGMA RESTRICT_REFERENCES
PRAGMA RESTRICT_REFERENCES(SUBPROGRAM_NAME, IDENTIFIER)
SUBPROGRAM_NAME can be default which will affect all the subprograms in packages or subprogram name(function or procedure) in package
IDENTIFIER can be
RNDS, WNDS, RNPS, WNPS and
TRUST. I will explain every one separately.
1- RNDS
select query is restricted against any of database tables
2- WNDS
DML operations are restricted against any of database tables
3- RNPS
Selection of package variables is restricted
4- WNPS
Modification in packages variables is restricted
5- TRUST
Asserts that the subprogram can be trusted not to violate one or more rules