Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: PRAGMA RESTRICT_REFERENCES question

Re: PRAGMA RESTRICT_REFERENCES question

From: John Russell <johnrussell10_at_home.com>
Date: Thu, 25 Jan 2001 07:57:24 GMT
Message-ID: <3a6fda69.253753393@news>

On Thu, 25 Jan 2001 03:40:11 GMT, gmei_at_my-deja.com wrote:

>Hi:
>
>Could someone tell me what is the "advantage" of using PRAGMA
>RESTRICT_REFERENCES, such as WNDS and WNPS, and why do you "want to" use
>it in certain case? I am reading this part in Steven Feuerstein's Oracle
>PL/SQL Programming book and would like to clarify it a bitter.
>
>Is there an example that one would want to use the PRAGMA in the package
>code and why?
>
>TIA.
I am not the world's expert on this pragma, so forgive me if I misstate.

The Oracle docs, primarily Application Developer's Guide - Fundamentals and PL/SQL Guide, have some sections concerning this pragma:

http://tahiti.oracle.com/pls/tahiti/tahiti.drilldown?word=restrict_references&book=&preference=&method=LIKE&expand_all=1

As I interpret the doc, certain instances of calling PL/SQL functions, such as from SQL statements, would be guaranteed to fail at runtime unless you specified the pragma. The pragma makes the PL/SQL compiler check at compile time that the procedure doesn't use certain constructs, so you can get rid of those constructs during the development cycle rather than debugging SQL statements that fail at runtime..

As of 8.1.6, the App Dev - Fundamentals book has this to say:

"PL/SQL Compilation Checking
A user-written function can now be called from a SQL statement without any compile-time checking of its purity: PRAGMA RESTRICT_REFERENCES is no longer required on functions called from SQL statements.

PRAGMA RESTRICT_REFERENCES remains available as a means of asking the PL/SQL compiler to verify that a function has only the side effects that you expect. SQL statements, package variable accesses, or calls to functions that violate the declared restrictions will continue to raise PL/SQL compilation errors to help you isolate the code that has unintended effects. "

John Received on Thu Jan 25 2001 - 01:57:24 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US