16.20 - Example: Displaying a Java UDF with Array and Period Data Types - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-24
dita:mapPath
wkf1512081455740.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
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    ?