18 Clauses Used in SQL Functions and Conditions for JSON
Clauses PASSING, RETURNING, wrapper,
error, empty-field, on-mismatch and TYPE are described for SQL functions
that use JSON data. Each clause is used in one or more of the SQL functions and conditions
is json, is not json, json_array,
json_arrayagg, json_equal,
json_exists, json_mergepatch,
json_query, json_object,
json_objectagg, json_serialize,
json_table, json_transform, and
json_value.
- PASSING Clause for SQL Functions and Conditions
Oracle SQL functionjson_transform, SQL/JSON functionsjson_valueandjson_query, and SQL/JSON conditionjson_existsaccept an optionalPASSINGclause, which binds SQL values to SQL/JSON variables for use in path expressions. - RETURNING Clause for SQL Functions
SQL functionsjson_array,json_arrayagg,json_mergepatch,json_object,json_objectagg,json_query,json_serialize,json_transform, andjson_valueaccept an optionalRETURNINGclause, which specifies the data type of the value returned by the function. This clause and the default behavior (noRETURNINGclause) are described here. - Wrapper Clause for SQL/JSON Query Functions JSON_QUERY and JSON_TABLE
SQL/JSON query functionsjson_queryandjson_tableaccept an optional wrapper clause, which specifies the form of the value returned byjson_queryor used for the data in ajson_tablecolumn. This clause and the default behavior (no wrapper clause) are described here. Examples are provided. - Error Clause for SQL Functions and Conditions
Some SQL query functions and conditions for JSON data accept an optional error clause, which specifies handling for a runtime error that is raised by the function or condition. This clause and the default behavior (no error clause) are summarized here. - Empty-Field Clause for SQL/JSON Query Functions
SQL/JSON query functionsjson_value,json_query, andjson_tableaccept an optionalON EMPTYclause, which specifies the handling to use when a targeted JSON field is absent from the data queried. This clause and the default behavior (noON EMPTYclause) are described here. - ON MISMATCH Clause for SQL/JSON Query Functions
You can use anON MISMATCHclause with SQL/JSON functionsjson_value,json_query, andjson_table, to handle type-matching exceptions. It specifies handling to use when a targeted JSON value does not match the specified SQL return value. This clause and its default behavior (noON MISMATCHclause) are described here. - TYPE Clause for SQL Functions and Conditions
SQL conditionjson_existsand functionsjson_transform,json_value,json_query, andjson_tableeach accept an optionalTYPEclause, which specifies whether JSON values are compared strictly with respect to JSON-language type, that is, as if the relevant "only" data-type conversion item methods were applied to the data being compared.
Parent topic: Query JSON Data