Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: oracle pragma problems with functions
A copy of this was sent to wizardlll_at_my-dejanews.com
(if that email address didn't require changing)
On Mon, 04 Jan 1999 15:16:13 GMT, you wrote:
>I'm having a problem with user-defined inline functions that are contained in
>a package that are using constants that are in another package. When I try
>it Oracle returns an error that the inline functions violate a package purity
>because they are trying to use the constants in the other package header.
>
>Thank You
Have you specified the package purity level of the reference package full of constants? For example:
SQL> create or replace package my_globals
2 as
3 x number default 5;
4
4 pragma restrict_references( my_globals, wnds, rnds, wnps, rnps );
5 end;
6 /
Package created.
with out the pragma above, the following code won't compile as the purity of my_globals has not been asserted...
SQL> create or replace package my_pkg
2 as
3 function getx return number; 4 pragma restrict_references( getx, wnds, rnds, wnps );5
SQL> create or replace package body my_pkg
2 as
3
3 function getx return number
4 is
5 begin
6 return my_globals.x;
7 end;
8
8
8 end;
9 /
Package body created.
SQL> select my_pkg.getx from dual;
GETX
5
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA
--
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Mon Jan 04 1999 - 12:12:00 CST