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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: User-defined functions in WHEN clause of a trigger

RE: User-defined functions in WHEN clause of a trigger

From: Naveen Nahata <naveen_nahata_at_mindtree.com>
Date: Wed, 11 Sep 2002 21:29:29 +0530
Message-Id: <22541.293566@fatcity.com>


Not sure but got a feeling that it has something to do with the "Purity Level" of the function. Something you declare with PRAGMA = RESTRICT_REFERENCES For a function to be usable in the DMLs, it needs to satisfy a few = purity
rules, which also need to be explicitly declared using PRAGMA RESTRICT_REFERENCES. Guess this might be the case in triggers as well.

Regards
Naveen

-----Original Message-----
From: Jesse, Rich [mailto:Rich.Jesse_at_qtiworld.com] Sent: Wednesday, September 11, 2002 10:10 PM To: Multiple recipients of list ORACLE-L Subject: User-defined functions in WHEN clause of a trigger

Hey all,

The subject says it all. In 8.1.7, can I:

	CREATE OR REPLACE TRIGGER my_trigger
	BEFORE UPDATE ON my_table
	FOR EACH ROW
	WHEN (my_function =3D 'SOME VALUE')
	BEGIN
		blah....
	END my_trigger;

Everytime I try to compile this, I get an "ORA-4076: invalid NEW or OLD specification". But I can specify a builtin function, e.g.:

        WHEN (SYS_CONTEXT('USERENV','HOST') =3D 'MYHOST') I've RTFM'd and tried Metalink as well, but I haven't been able to find anything that says I can't use a user-defined function here.

Anyone?

Rich Jesse                           System/Database Administrator
Rich.Jesse_at_qtiworld.com              Quad/Tech International, Sussex, WI =
USA
--=20

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--=20

Author: Jesse, Rich
  INET: Rich.Jesse_at_qtiworld.com
Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Wed Sep 11 2002 - 10:59:29 CDT

Original text of this message

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