17.05 - Row Partitioning a Bitemporal Table - Teradata Database

Teradata Vantage™ - Temporal Table Support

prodname
Advanced SQL Engine
Teradata Database
vrm_release
17.00
17.05
created_date
June 2020
category
Programming Reference
featnum
B035-1182-170K

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