15.10 - Example: Passing BSON Data to a Java UDF - Teradata Database

Teradata Database Teradata JSON

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1150-151K

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