16.20 - Example: Using a Trigger to Update a NoPI Table - 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
Language
English (United States)
Last Update
2019-05-24
dita:mapPath
wkf1512081455740.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval

The following CREATE TRIGGER request creates a statement trigger that does an INSERT … SELECT of the values represented by a and b from the OLD_TABLE transition table (aliased as myold ) into NoPI table nopi008_t999 whenever NoPI table nopi008_ti is updated.

     CREATE TRIGGER nopi008_trig4 
       AFTER UPDATE ON nopi008_t1
       REFERENCING OLD_TABLE AS myold 
     FOR EACH STATEMENT (
       INSERT INTO nopi008_t999(a,b) 
         SELECT a,b 
         FROM myold;);