Example: Invoking an SQL UDF From a MERGE Request - 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™

This example shows how to invoke an SQL UDF named value_expression at several points within a MERGE request.

     MERGE INTO t1
     USING (SELECT a2, b2, c2
            FROM t2
            WHERE test.value_expression(b2, c2))
                  source_tbl(a2, b2, c2)
     ON a1 = source_tbl.a2 AND
        b1 = test.value_expression(source_tbl.b2, source_tbl.c2)
     WHEN MATCHED THEN
     UPDATE SET b1 = b2, c1 = test.value_expression(2,3)
     WHEN NOT MATCHED THEN
     INSERT (a2, test.value_expression(4,5), c2);