Re: PL/SQL Purity Levels

From: Martin Purbrook <martin_at_kbss.bt.co.uk>
Date: 1997/04/23
Message-ID: <5jkfbp$845_at_pheidippides.axion.bt.co.uk>#1/1


In article <335D3146.34F2_at_ornl.gov>, John Hough <q6y_at_ornl.gov> wrote: [snip]
>....All of the resources we have
>checked (Oracle Application Developers Guide, Oracle Press
>PL/SQL book and the O'Reilly PL/SQL book state the WNPS
>and RNPS mean that you cannot WRITE or READ package var-
>iables "OUTSIDE" the package in which your function resides.
>It is permissible however to WRITE/READ package variables
>contained in the same package as your function. The Oracle
>Press book by Scott Urman has an example using this on page
>270-271.

I've just had a look at the App. Dev. Guide for 7.3, which says the following:

RNPS: means "reads no package state" (does not reference the values of packaged variables)

The context of this is 'the function', hence in you example, the function is attempting to breach the pragma.

The O'Reilly book (Steven Feuerstein) says (p752):

RNPS Reads No Package State. Asserts that the function does not read any package variables.

> PRAGMA RESTRICT_REFERENCES(NumHistoryMajors, WNDS, WNPS, RNPS);
 ..
>
>CREATE OR REPLACE PACKAGE BODY StudentOps AS
>
> -- Packaged variable to hold the number of history majors.
> v_NumHist NUMBER;
>
 ..
> FUNCTION NumHistoryMajors RETURN NUMBER IS
> v_Result NUMBER;
> BEGIN
> IF v_NumHist IS NULL THEN < Here you are referencing the

                                  package state
[snip]

Hope this helps,

MPP Martin Purbrook +44 1473 605208 martin_at_kbss.bt.co.uk (FAX)+44 1473 622451 Received on Wed Apr 23 1997 - 00:00:00 CEST

Original text of this message