INSERT Statement (ANSI System-Time Table Form) | Teradata Vantage - INSERT (ANSI System-Time Table Form) - Advanced SQL Engine - Teradata Database

ANSI Temporal Table Support

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
ngt1556732962433.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1186
lifecycle
previous
Product Category
Teradata Vantage™

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 the 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 the 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);
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 the 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.