17.10 - Example: Non-Valid WHEN Clause - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1144-171K
Language
English (United States)

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.