The following CREATE TRIGGER request fails because the WHEN condition contains an aggregate function, but is not specified in a subquery:
CREATE TRIGGER trigwhen2 AFTER INSERT ON t1 REFERENCING NEW_TABLE AS NewTab FOR EACH STATEMENT WHEN (10 < MAX(NewTab.a)) ABORT;
Result:
*** Failure 5430 The Trigger WHEN clause cannot contain an aggregate or table reference.