Example: With a Guaranteed Single-Row Source Relation, You Do Not Need To Specify the Partitioning Column Set - Analytics Database - Teradata Vantage

SQL Data Manipulation Language

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-04-05
dita:mapPath
pon1628111750298.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
esx1472246586715
lifecycle
latest
Product Category
Teradata Vantage™

Because the following MERGE request guarantees a single-row source relation by specifying an equality condition on the USI of target RPPI table t1, it is not necessary to specify the partitioning column set:

     CREATE TABLE t1 (
       a1 INTEGER,
       b1 INTEGER,
       c1 INTEGER)
     PRIMARY INDEX (a1)
     PARTITION BY b1;

     CREATE TABLE t2 (
       a2 INTEGER,
       b2 INTEGER,
       c2 INTEGER)
     PRIMARY INDEX (a2),
     UNIQUE INDEX(b2);
     MERGE INTO t1
       USING (SELECT *
              FROM t2
              WHERE b2=10) AS s
       ON a1=1
     WHEN MATCHED THEN
       UPDATE SET c1=c2
     WHEN NOT MATCHED THEN
       INSERT (c2, b2, c2);