16.20 - Example: Non-Valid WHEN Clause - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Content Type
Programming Reference
Publication ID
B035-1144-162K
Language
English (United States)
Last Update
2019-05-24

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.