15.10 - INSERT (ANSI System-Time Table Form) - Teradata Database

Teradata Database ANSI Temporal Table Support

prodname
Teradata Database
vrm_release
15.00
15.10
category
Programming Reference
featnum
B035-1186-015K

Purpose  

Add new rows to ANSI system-time tables.

Syntax  

There is no special temporal syntax for inserting rows into temporal tables. Use the standard SQL INSERT statement. However, note the following:

  • You must include values for the beginning and ending bound columns that constitute the system-time derived period column.
  • Values entered for the system-time columns will be automatically replaced by Teradata Database, so can be any values of any type. The value for the beginning system-time column will be replaced by the value of the TEMPORAL_TIMESTAMP function at the time of the insertion, and the ending system-time value will be replaced automatically with the maximum system timestamp value, 9999-12-31 12:59:59.999999+00:00.
  • As for any type of derived period column in Teradata Database, you cannot insert Period type values for the derived period column itself.
  • Example : Inserting Rows into an ANSI System-Time Table

    INSERT INTO employee_system_time VALUES 
     (1001,'Sania',111,TIMESTAMP'2002-01-01 00:00:00.000000+00:00',                    TIMESTAMP'2002-07-01 12:00:00.350000+00:00');
    INSERT INTO employee_systime VALUES 
     (1001,'Fred',222, TIMESTAMP'2002-07-01 12:00:00.350000+00:00',                    UNTIL_CLOSED);
    INSERT INTO employee_systime VALUES (1002,'Ash',333,123,456);
    INSERT INTO employee_systime VALUES (1003,'SRK',111,,’nothing');
    INSERT INTO employee_systime VALUES(1003,'Alice',222,’Wonder',NULL);

    Note: Values for the start and end columns that constitute the system-time period must be provided in the INSERT statement, but they will be automatically replaced by Teradata Database. The start time value will be replaced by the value of the TEMPORAL_TIMESTAMP function at the time of the insertion. The end time value will be replaced by the maximum system TIMESTAMP(6) WITH TIME ZONE value, 9999-12-31 23:59:59.999999+00:00.