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: Can't use FUNCTION in SQL?

Re: Can't use FUNCTION in SQL?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sat, 28 Aug 1999 18:30:18 GMT
Message-ID: <37d92a49.17430984@newshost.us.oracle.com>


A copy of this was sent to hlh_nospam_at_excite.com (Howard Lee Harkness) (if that email address didn't require changing) On Sat, 28 Aug 1999 16:31:03 GMT, you wrote:

>In Owens' book on PL/SQL, he states that a function "evaluates to the
>value of some datatype which can be substituted in any place where a
>variable of the same type can be placed."
>
>However, I tried to use a function in an insert statement in place of
>a variable, and the resulting package would not compile. A simplified
>example:

[snip]

in Oracle8.0 and before you have to assert the purity level of packaged procedures and functions.

In your package specification, add:

  function SplitAssay(....);
  PRAGMA RESTRICT_REFERENCES( SplitAssay, WNDS );  

the pragma tells the compiler to verify that the function does NOT write to the database state (minimal requirement to be callable from SQL)

--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Sat Aug 28 1999 - 13:30:18 CDT

Original text of this message

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