JSON_MERGEPATCH

Syntax

Description of the illustration json_mergepatch.gif

JSON_returning_clause::=

Description of the illustration json_returning_clause.gif

json_on_error_clause::=

Description of the illustration json_on_error_clause.gif

Purpose

You can use the JSON_MERGEPATCH function to update specific portions of a JSON document. You pass it a JSON Merge Patch document in JSON_patch_expr, which specifies the changes to make to a specified JSON document, the JSON_target_expr.

JSON_MERGEPATCH evaluates the patch document against the target document to produce the result document. If the target or the patch document is NULL, then the result is also NULL.

You can input any SQL data type that supports JSON data: JSON, VARCHAR2, CLOB, or BLOB. The function returns any of the SQL data types as output.

Data type JSON is available only if database initialization parameter compatible is 20 or greater.

The default return type depends on the input data type. If the input type is JSON, then JSON is also the default return type. Otherwise, VARCHAR2 is the default return type.

The JSON_returning_clause specifies the return type of the operator. The default return type is VARCHAR2(4000).

The PRETTY keyword specifies that the result should be formatted for human readability.

The ASCII keyword specifies that non-ASCII characters should be output using JSON escape sequences.

The TRUNCATE keyword specifies that the result document should be truncated to fit in the specified return type.

The JSON_on_error_clause optionally controls the handling of errors that occur during the processing of the target and patch documents.

See Also: