-
Junior Member
Function purity in PL/SQL
what is the need for using function purity in PL/SQL .
-
Junior Member
Re: Function purity in PL/SQL
I found the ans as: any function called from the sql statement have certain side effects on the database tables and package variables.these side effects are specified using purity levels.and diff purity levels r wnds-->write no database state rnds-->read no database state wnps-->write no package state rnps-->read no package state
-
use the pragma RESTRICT_REFERENCES for the purpose.
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.
Last edited by jamesravid; 07-24-2007 at 07:01 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules