Subject | RE: [firebird-support] problem with before update trigger |
---|---|
Author | Leyne, Sean |
Post date | 2009-12-09T23:56:16Z |
Maurizio,
Triggers fire based on the entire operation, not based on change to selected fields/columns.
You would need to add logic to the trigger to determine whether you want the "meat" of the trigger to execute.
Ie.
CREATE TRIGGER ...
AS
BEGIN
IF (NEW.testupdated IS NOT DISTINCT FROM OLD.testupdated) THEN BEGIN
... do some logic
END
END
Sean
> in a table i have a field 'testupdated' ,No, it is not possible.
> in the same table in the before update event i have
> a trigger : ' mytable.testupdated = 'S' ,
> of course i can''t set its value to 'N' ......that trigger will change
> it in 'S' ,
> is it possible to exclude fields from that event ?
> .... in other words : don't fire the trigger when the field
> 'testupdated' changes .
Triggers fire based on the entire operation, not based on change to selected fields/columns.
You would need to add logic to the trigger to determine whether you want the "meat" of the trigger to execute.
Ie.
CREATE TRIGGER ...
AS
BEGIN
IF (NEW.testupdated IS NOT DISTINCT FROM OLD.testupdated) THEN BEGIN
... do some logic
END
END
Sean