Mutating triggers

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


[Quoted] [Quoted] I have a table that has a conditional unique constraint on it. [Quoted] 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.

[Quoted] 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 CET

Original text of this message