Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Mutating triggers
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