16.10 - Example: ARRAY Parameter in a Java UDF - Teradata Database

Teradata Database SQL Data Types and Literals

prodname
Teradata Database
vrm_release
16.10
created_date
June 2017
category
Programming Reference
featnum
B035-1143-161K
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