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

Home -> Community -> Usenet -> c.d.o.misc -> Re: RESTRICT_REFERENCES and DBMS_SQL Catch 22?

Re: RESTRICT_REFERENCES and DBMS_SQL Catch 22?

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Fri, 11 Jun 1999 20:25:21 +0100
Message-ID: <929129336.11771.0.nnrp-01.9e984b29@news.demon.co.uk>

The need for 'pure' functions, i.e. restrict_references(xx, wnds etc..) applies only to functions which you want to call from SQL, along the lines of:

    select get_my_desired_row('table_name') from dual;

is this really what you want to do ?

--

Jonathan Lewis
Yet another Oracle-related web site: www.jlcomp.demon.co.uk

marckell_at_best.com wrote in message <7jrire$mb7$1_at_nnrp1.deja.com>...
>Could someone tell me which one I'm mistaken about, or if there is a
>workaround:
>
>1. When creating a PLSQL function, you need to add a RESTRICT_REFERENCES
>pragma to the package to enforce read-only rights to the function.
>Otherwise the block won't run (error of "No guarantee it won't write" or
>something along those lines).
>
>2. When using RESTRICT_REFERENCES, you can't use DBMS_SQL for
>inserting variables into SQL statements, as this violates the purity of
>RESTRICT_REFERENCES. The SQL statement is not known at compile-time,
>so it won't allow the block to be used.
>
>3. The only way to create a SQL statement dynamically, which
>is necessary in my case because the table name is unknown until
>it's run, is to use DBMS_SQL.
>
>Catch 22.
>
>So my initially simplistic function in which I would pass
>in the name of a table and return a single value from that
>table is turning into a ridiculously confusing project, unless
>someone here can tell me where I'm going wrong.
>
>Oracle 7.33/DEC OSF1 V4
>
>mk
>
>
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
Received on Fri Jun 11 1999 - 14:25:21 CDT

Original text of this message

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