Example: JSON Type Parameter and Return Type For a Java UDF

Teradata Vantageā„¢ JSON Data Type

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1150-162K

This example shows a Java UDF defined with a JSON type input parameter and return type.

REPLACE FUNCTION json_func1 (json_param JSON(100) CHARACTER SET LATIN)
                                RETURNS JSON(100) CHARACTER SET LATIN
LANGUAGE JAVA
NO SQL
PARAMETER STYLE JAVA 
EXTERNAL NAME 'JSON_JAR:JSONUDF.json_func1';

Here is another example of how the function can be defined:

REPLACE FUNCTION DB1.JSON_FUNC1 (json_param JSON(100) CHARACTER SET LATIN)
                                    RETURNS JSON(100) CHARACTER SET LATIN
SPECIFIC json_func1
LANGUAGE JAVA
NO SQL
NO EXTERNAL DATA
PARAMETER STYLE JAVA
NOT DETERMINISTIC
CALLED ON NULL INPUT
EXTERNAL NAME 'JSON_JAR:JSONUDF.json_func1(java.sql.Clob) returns java.sql.Clob';


public static java.sql.Clob json_func1(java.sql.Clob json_clob)
   {
      return json_clob;
   }