Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Help required with RESTRICT_REFERENCES
On Tue, 08 Dec 1998 11:02:18 GMT, mike_pinker_at_iint.com wrote:
>I have a question about PRAGMA RESTRICT_REFERENCES
>
>I understood that the purity of a function within a package was defined by
>the use of PRAGMA RESTRICT_REFERENCES. Also, to assert a purity level one had
>to make sure that the function didn't violate this level, either directly (
>UPDATE/assignment ) or indirectly by calling a function with a lower purity
>level. However, I have found that adding a function with a lower purity level
>to a package has affected purity level of other more pure functions in the
>package. This new function is not called by any of the existing functions.
>
Are you setting the purity level of the package itself or of each individual function in the package?
eg
create table chris(
id number )
/
create or replace
package myPackage as
function pure return number;
pragma restrict_references( pure, WNDS );
function not_pure return number;
end myPackage;
/
create or replace
package body myPackage as
function pure return number is
begin
return 100;
end pure;
function not_pure return number is
num number;
begin
insert into chris values ( 100 );
return 100;
end not_pure;
end myPackage;
/
SQL> select myPackage.pure from dual;
PURE
100
SQL> select myPackage.not_pure from dual; select myPackage.not_pure from dual
*
ERROR at line 1:
ORA-06571: Function NOT_PURE does not guarantee not to update database
Use pragma restrict_references to set the purity level of each function and not the package itself.
hope this helps.
chris.
>Is this correct? Does anyone have any ideas?
>
>Thanks
>
>Mike
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
--
Christopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.
![]() |
![]() |