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

SQL Data Definition Language Syntax and Examples

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
jco1628111346878.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
mdr1472255012272
lifecycle
latest
Product Category
Teradata Vantage™
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;

Result:

*** Help information returned. 3 rows.
 *** Total elapsed time was 1 second.

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