Trigger comparing columns on UPDATE
Posted on 2007-11-15
Hi Experts -
I'm trying to write an UPDATE trigger for an Oracle database. The goal is to check an existing date column to make sure the newly updated column is later.
Here's what I have:
CREATE or REPLACE TRIGGER trigger_name
BEFORE INSERT OR UPDATE date1 ON sometable1
FOR EACH ROW
IF (_______date2 < _______date1) THEN
RAISE_APPLICATION_ERROR(-20001, Date2 must be greater than Date1);
When I do an insert with a date2 that is before date1, the trigger is not firing. I don't know what to put in the underlined fields above (:new., :old, etc.).
Thanks for any insight you can provide.