17.00 - Example: Displaying a Java UDF with Array and Period Data Types - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Release Date
September 2020
Content Type
Programming Reference
Publication ID
B035-1144-170K
Language
English (United States)
This statement creates a user defined type named phonenumbers_ary as an array:
CREATE TYPE phonenumbers_ary AS CHAR(10) ARRAY[5];
This statement creates a user defined type named MYINT as an integer:
CREATE TYPE MYINT AS INTEGER FINAL;
The UDF is created using phonenumber_ary and Period(date) type parameters and returns a MYINT type value.
CREATE FUNCTION getPhoneNums(parameter_1 phonenumber_ary,
                  parameter_2 Period(Date))
        RETURNS MYINT
        LANGUAGE JAVA
        NO SQL
        PARAMETER STYLE JAVA 
        EXTERNAL NAME 
        'UDF_JAR:UserDefinedFunctions.getPhoneNums';
Following is an example of HELP FUNCTION for a Java UDF:
HELP FUNCTION getPhoneNums;
*** Help information returned. 3 rows.
 *** Total elapsed time was 1 second.

Parameter Name                 Type Comment
------------------------------ ---- -----------------------------
parameter_1                    A1    ?
parameter_2                    PD    ?
RETURN0                        UT    ?