ON Clause Conditions - Teradata Database

SQL Data Manipulation Language

Product
Teradata Database
Release Number
15.10
Language
English (United States)
Last Update
2018-10-06
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata® Database

ON clause conditions have the same restrictions as join conditions with the additional restriction that an ON clause cannot specify a subquery.

The following MERGE request is not valid because it specifies a subquery in its ON clause:

     MERGE INTO t1
     USING t2
       ON a1=a2 AND c1 IN (SELECT b2
                           FROM   t2)
     WHEN MATCHED THEN
       UPDATE SET c1=c2+2;

The following MERGE request is not valid because it specifies an aggregate operator, SUM, in its ON clause:

     MERGE INTO t1
     USING t2
       ON a1=a2 AND SUM(b1)=10
     WHEN NOT MATCHED THEN
       INSERT (a2,b2,c2);