15.10 - Example: Non-Valid WHEN Clause - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1144-151K

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;
     *** Failure 5430 The Trigger WHEN clause cannot contain an aggregate or table reference.