You can create a UDF containing one or more parameters and return type that are a JSON data type. The JSON type is supported for the following types of UDFs:
- Scalar and aggregate UDFs, table functions, and table operators written in C, C++, or Java.
- SQL UDFs
For SQL UDFs, the RETURN clause can be an SQL statement that evaluates to the JSON data type.
You can specify the JSON type with the STORAGE FORMAT specification to pass binary JSON data to an external routine.
JSON FNC functions and Java classes and methods are provided to enable a UDF or external stored procedure to access and set the value of a JSON parameter, or to get information about the JSON type parameter.
- Example: UDF Parameter Style SQL
- Example: UDF Parameter Style TD_GENERAL
- Example: SQL UDF with RETURN Clause
- Example: UDF Returning a Value Using Dot Notation (Level 1)
- Example: UDF Returning a Value Using Dot Notation (Level 2)
- Example: UDF Returning a Value Using Dot Notation (Level 3)
- Example: JSON Type Parameter and Return Type for a Java UDF