WHEN clause The WHEN clause is an optional part of a CREATE TRIGGER statement. CREATE TRIGGER statementWHEN clause triggersWHEN clause WHEN clauseCREATE TRIGGER statement Syntax 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.

The use of a WHEN clause in a CREATE TRIGGER statement is valid only after a database has been fully upgraded to Release 10.11 or higher. (See "Upgrading a database" in the for more information.) This clause has no meaning in a database that is at Release 10.10 or lower.
Example 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