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

Home -> Community -> Usenet -> c.d.o.server -> Mutating triggers

Mutating triggers

From: Chris Halioris <halioris_chris_nonlilly_at_lilly.com>
Date: 1997/01/21
Message-ID: <32E5374E.2ECB@lilly.com>#1/1

I have a table that has a conditional unique constraint on it. Assume I have two columns: parm_code and code_value. If parm_code = 'A' then the code_value must be unique for all rows with parm_code='A'.
If parm_code != 'A' then the code value does not have to be unique. Hence, I cannot create a unique constraint on parm_code and code_value.

Therefore I created a database trigger to check if parm_code = 'A' then see if there are any other records with parm_code = 'A' and code_value = :new.code_value (and if there is I raise_application_error). The trigger works fine for an insert but mutates on an update. Is there a trick to doing something like this, or a better way?

Chris Halioris Received on Tue Jan 21 1997 - 00:00:00 CST

Original text of this message

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