15.10 - Example: Setting a Default Address to Replace an Inserted Null - 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 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');