Example: Logging MERGE Errors - 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™

The following MERGE request logs all error types, including data errors, referential integrity errors, and USI errors, with an error limit of 100 errors.

     MERGE INTO tgttbl AS t1
     USING  (SELECT c1,c2,c3
             FROM srctbl) AS t2
       ON t1.c1=t2.c1
     WHEN MATCHED THEN
       UPDATE SET t1.c2=t2.c2 + t1.c2,  t1.c3=t2.c3
     WHEN NOT MATCHED THEN
       INSERT INTO t1 VALUES (t2.c1, t2.c2, t2.c3)
     LOGGING ERRORS WITH LIMIT OF 100;