17.05 - Example: UPDATE Using an SQL UDF Invocation in the SET and WHERE Clauses - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1146-175K
Language
English (United States)
Assume you have created an SQL UDF named value_expression. The following example updates table t1 using the result of value_expression when it is passed values for columns a1 and b1 to update columns a1 and b1 for rows where the invocation of value_expression using the values for columns c1 and d1 are greater than 5.
     UPDATE t1
     SET b1 = test.value_expression(t1.a1, t1.b1)
     WHERE test.value_expression(t1.c1, t1.d1) > 5;