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
Published
January 2021
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
vnq1596660420420.ditamap
dita:ditavalPath
hoy1596145193032.ditaval

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  ;