17.05 - Example: Failure Because the Matching Condition is Defined on a PERIOD Bound Function - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1146-175K
Language
English (United States)

This example fails because the matching condition of the MERGE request is defined on a BEGIN Period bound function.

     CREATE TABLE source(
       a INTEGER,
       b PERIOD(DATE),
       c INTEGER);

     CREATE TABLE target(
       i INTEGER,
       j PERIOD(DATE),
       k INTEGER)
     PRIMARY INDEX(i)
     PARTITION BY Begin(j);

     INSERT INTO source(1, PERIOD(DATE, UNTIL_CHANGED), 1);
     MERGE INTO target
       USING source
       ON a=i AND BEGIN(j) = END(b)
     WHEN MATCHED THEN
       UPDATE SET k=c  ;