15.10 - Example: Passing BSON Data to 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

The Java UDF in this example is defined with a JSON type parameter. Therefore, if you pass BSON data to this function, the binary JSON data is converted to a CLOB type and mapped to java.sql.Clob.

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


public static int jbson_func1(java.sql.Clob bson_clob) 
   {
      return 0;
   }