15.10 - Example: JSON Type Parameter and Return Type For a Java UDF - Teradata Database

Teradata Database Teradata JSON

Product
Teradata Database
Release Number
15.10
Published
December 2015
Language
English (United States)
Last Update
2018-06-05
dita:mapPath
TeradataJSON_15_10.ditamap
dita:ditavalPath
ft:empty

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;
   }