17.10 - Example: Nontemporal Insert into a Bitemporal Table - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Temporal Table Support

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1182-171K
Language
English (United States)

A nontemporal insert in to a bitemporal table is similar to a conventional insert, where the valid-time and transaction-time columns are treated as any other column in the table. You can use a nontemporal insert to insert closed or open rows.

To perform a nontemporal insert, you must have the NONTEMPORAL privilege on the target table.

Consider the following bitemporal table:

   CREATE MULTISET TABLE Policy_History(
      Policy_ID INTEGER,
      Customer_ID INTEGER,
      Policy_Type CHAR(2) NOT NULL,
      Policy_Details CHAR(40),
      Validity PERIOD(DATE) NOT NULL AS VALIDTIME,
      Policy_Duration PERIOD(TIMESTAMP(6) WITH TIME ZONE) NOT NULL
         AS TRANSACTIONTIME)
   PRIMARY INDEX(Policy_ID);

The following nontemporal INSERT statements insert rows into Policy_History, explicitly specifying values for the valid-time and transaction-time columns:

   NONTEMPORAL INSERT INTO Policy_History
      VALUES (411458, 160350204, 'AU', 'STD-CH-340-YXN-01',
         PERIOD '(2009-12-03, 2010-12-01)',
         PERIOD (TIMESTAMP '2004-01-01 00:00:00.000000', UNTIL_CLOSED));

   NONTEMPORAL INSERT INTO Policy_History
      VALUES (114583, 603502048, 'AU', 'STD-CH-920-YXD-01',
         PERIOD '(2009-12-08, 2010-12-07)',
         PERIOD (TIMESTAMP '2004-01-01 00:00:00.000000', UNTIL_CLOSED));