16.20 - Example: Setting a Default Address to Replace an Inserted Null - 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 example sets a UDT employee address to a default if the inserted address is null.

    CREATE TRIGGER DefaultEmployeeAddress 
      BEFORE INSERT ON Employee
      REFERENCING NEW AS NewRow
      FOR EACH ROW
       WHEN (NewRow.address IS NULL)
       SET NewRow.address =
           address().street('17095 Via Del Campo').zip('92127');