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

From: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 7 Oct 2008 13:41:04 -0800
Message-ID: <48ebc960$1@news.victoria.tc.ca>


Kevin S (SearleK_at_googlemail.com) 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

The SQL statement does not have access to the function unless it is declared in the package (header) and referenced using its full name.

  • in package (header) FUNCTION myfnc(p1 IN t1.c1%TYPE) RETURN VARCHAR2 ;

: Update t1
: set c1 = myfnc(c2);

Update t1
set c1 = myPackage.myfnc(c2); Received on Tue Oct 07 2008 - 16:41:04 CDT

Original text of this message