The WHEN clause is an optional part of a CREATE TRIGGER statement.
WHEN ( booleanExpression )
If a trigger has been created with a WHEN clause, and the trigger event takes place, the triggeredSQLStatement will be executed only if the booleanExpression in the WHEN clause evaluates to TRUE. If it evaluates to FALSE or NULL, the triggeredSQLStatement will not be executed.
The transition tables or transition variables defined in the REFERENCING clause can be referenced from the WHEN clause.
The restrictions listed for the triggeredSQLStatement in the CREATE TRIGGER statement also apply to the WHEN clause.
CREATE TRIGGER FLIGHTSUPDATE AFTER UPDATE ON FLIGHTS REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW WHEN (OLD.FLIGHT_ID <> NEW.FLIGHT_ID) UPDATE FLIGHTAVAILABILITY SET FLIGHT_ID = NEW.FLIGHT_ID WHERE FLIGHT_ID = OLD.FLIGHT_ID