16.20.16.20 - 16.20 - Example: ARRAY Parameter in a Java UDF - Teradata Vantage NewSQL Engine

Teradata Vantageā„¢ Data Types and Literals

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1143-162K
CREATE TYPE phonenumbers_ary AS CHAR(10) ARRAY[5];

REPLACE FUNCTION getPhoneNums(A1 phonenumbers_ary)
RETURNS INTEGER
LANGUAGE JAVA
NO SQL
PARAMETER STYLE JAVA 
EXTERNAL NAME 'UDF_JAR:UserDefinedFunctions.getPhoneNums';

public static int getPhoneNums(java.sql.Array a1) throws SQLException

Alternatively, you can define the function as follows:

REPLACE FUNCTION getPhoneNums(A1 phonenumbers_ary)
RETURNS INTEGER
LANGUAGE JAVA
NO SQL
PARAMETER STYLE JAVA 
EXTERNAL NAME 
'UDF_JAR:UserDefinedFunctions.getPhoneNums(java.sql.Array) returns int';

public static int getPhoneNums(java.sql.Array a1) throws SQLException