17.10 - Writing a UDF That Uses TD_ANYTYPE UDT Parameters - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1184-171K
Language
English (United States)

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.