Re: Function 'myfunc' may not be used in SQL

From: DA Morgan <damorgan_at_psoug.org>
Date: Tue, 07 Oct 2008 13:26:17 -0700
Message-ID: <1223411175.212566@bubbleator.drizzle.com>


Kevin S wrote:
> Hello,
>
> I have created a simple function for use in an update statement. The
> fuction is
>
> FUNCTION myfnc(p1 IN t1.c1%TYPE)
> RETURN VARCHAR2
> IS
> BEGIN
> IF p1 = 3 THEN
> RETURN 'A';
> ELSE
> RETURN 'B';
> END IF;
> END myfnc;
>
> I use it in a procedure which exists in the same package as the
> function as follows
>
> Update t1
> set c1 = myfnc(c2);
>
> I am getting Function 'myfunc' may not be used in SQL.
>
> There is no db manipulation going on and I have tried using
> PRAGMA RESTRICT_REFERENCES (myfnc, WNDS, WNPS, RNDS, RNPS);
> but to no avail.
>
> Any suggestions?

If the function is in a package then there is no function named myfnc. Try package_name.function_name.

-- 
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Tue Oct 07 2008 - 15:26:17 CDT

Original text of this message