17.10 - Row Partitioning 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)

To row partition a bitemporal table, use the following PARTITION BY clause.

Example: Row partitioning a bitemporal table

   CREATE MULTISET TABLE Policy_Bitemp (
      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)
   PARTITION BY CASE_N(
      (END(Validity) IS NULL OR
       END(Validity) >= CURRENT_DATE AT
                        INTERVAL -'12:59' HOUR TO MINUTE) AND
       END(Policy_Duration) >= CURRENT_TIMESTAMP,
       END(Validity) < CURRENT_DATE AT
                       INTERVAL -'12:59' HOUR TO MINUTE AND
       END(Policy_Duration) >= CURRENT_TIMESTAMP,
       END(Policy_Duration) < CURRENT_TIMESTAMP);