15.10 - Example: Using a Trigger to Update a NoPI Table - 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 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;);