Writing a UDF That Uses TD_ANYTYPE UDT Parameters - 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 write scalar and aggregate UDFs that use TD_ANYTYPE as a parameter or return data type for external routines written in C or C++, but not for external routines written in Java. The FNC library routines that are valid for structured UDTs are also valid for dynamic UDTs, but the specific FNC library function for the TD_ANYTYPE dynamic UDT is FNC_GetAnyTypeParamInfo. See Teradata Vantage™ - SQL External Routine Programming, B035-1147 for more information about the FNC_GetAnyTypeParamInfo library function.

An illustrative example CREATE FUNCTION request for the function definition might look like this.

CREATE FUNCTION udf_3 (
  a TD_ANYTYPE,
  b TD_ANYTYPE)
  RETURNS TD_ANYTYPE;

This function takes two TD_ANYTYPE input parameters, a and b, and returns a TD_ANYTYPE result parameter. The parameter data types are determined at run time when the function is called.

See Teradata Vantage™ - Data Types and Literals, B035-1143 for more information about the TD_ANYTYPE data type and Teradata Vantage™ - SQL External Routine Programming, B035-1147 for more information about how to best code external routines that support the TD_ANYTYPE type.