17.10 - Example: ARRAY Parameter in a Java UDF - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1143-171K
Language
English (United States)
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