15.00 - Writing a UDF That Uses TD_ANYTYPE UDT Parameters - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

prodname
Teradata Database
vrm_release
15.00
category
Programming Reference
featnum
B035-1184-015K

Writing a UDF That Uses TD_ANYTYPE UDT Parameters

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 SQL External Routine Programming 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 SQL Data Types and Literals for more information about the TD_ANYTYPE data type and SQL External Routine Programming for more information about how to best code external routines that support the TD_ANYTYPE type.