16.20 - Method Signature for Table UDFs - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Programming Reference
Publication ID
B035-1147-162K
Language
English (United States)
public class  class_name  {

   ...

   public static void  method_name  (  type_1        input_parameter_1,
                                    ...,
                                    type_n        input_parameter_n,
                                    result_type_1   result_1,
                                    ...,
                                    result_type_r   result_r)
   {
        ...
   }

   ...

}

where:

Parameter... Specifies...
type_n input_parameter_n the input parameters, where n is the number of parameters in the CREATE FUNCTION definition. If n = 0, no input parameters appear. The type is a Java primitive or class corresponding to the SQL data type of the input argument.

The maximum number of input parameters is 128.

result_type_r result_r the row result output parameters, where r is determined by the corresponding CREATE FUNCTION or REPLACE FUNCTION definition.

If the table UDF is defined with fixed result row specification, then...

  • r is the number of columns in the column list in the RETURNS TABLE clause in the corresponding CREATE FUNCTION definition.
  • The type is a Java primitive or class that matches the SQL data type of the corresponding column in the RETURNS TABLE clause of the CREATE FUNCTION statement.

If the table UDF is defined with dynamic result row specification, then...

  • r is the maximum number of columns in the RETURNS TABLE VARYING COLUMNS clause in the corresponding CREATE FUNCTION definition.
  • The type for each result_r parameter must be java.lang.Object[] because the actual data types of the result row arguments are unknown until function invocation.
  • During execution, the Java method can invoke the Tbl.getColDef() method to get the actual result types.

The method must return at least one result row output argument.