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.