SQL UDFs and SQL Cursors - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

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
2023-07-11
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1184
lifecycle
latest
Product Category
Teradata Vantage™

You can invoke SQL UDFs from within an SQL cursor. The rules for invoking an SQL UDF from within a cursor are the same as those for any other expression specified within an SQL cursor (see Teradata Vantage™ - SQL Stored Procedures and Embedded SQL, B035-1148 for details).

This example invokes an SQL UDF in the WHERE clause of a SELECT request in a cursor.

DECLARE ex1 CURSOR FOR
  SELECT *
  FROM t1
  WHERE df2.common_value_expression(t1.a1, t1.b1) > 1
  ORDER BY t1.a1;

This example invokes an SQL UDF in an UPDATE request in a cursor.

DECLARE ex3 CURSOR FOR
  UPDATE t1 SET b1 = df2.common_value_expression(t1.a1, t1.b1)
  WHERE c1 > 10;