(if that email address didn't require changing)
>I have written this as a function and as a package. The function works
>just fine, but when I try to call the same function within a package I
>get this error. Any Suggestons? There is nothing but select statemnts
>in the function just calculating an average against criteria that I can
>use in a view.
packaged functions in all versions of Oracle before Oracle8i, release 8.1, must
specify their purity.
In the package specification, immediately after the prototype for this function
pragma restrict_references( calc_avg, wnds, wnps, rnps );
to specify that is:
WNDS - writes no database state (eg: no inserts)
WNPS - writes no package state
RNPS - reads no package state
Since it does RNDS (reads the database state) we'll leave that out.....
>Function CALC_AVG (CTID in varchar2, ASSAYTR in varchar2, ATYPE in
> select avg(decode(operator,'=',result,null))
> assayid = ASSAYTR and
> sampleid = CTID and
> datatype = ATYPE;
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
Oracle Service Industries Reston, VA USA
Opinions are mine and do not necessarily reflect those of Oracle Corporation