13.16 JSON_TRANSFORM Operator RENAME
JSON_TRANSFORM
operator RENAME
renames a
field.
It renames the field that's targeted by the LHS path expression to the value of the RHS SQL expression. The RHS expression must evaluate to a SQL string; otherwise, an error is raised.
Example 13-31 JSON_TRANSFORM: Renaming a Field
This code renames field abc
to
xyz
:
SELECT json_transform('{"abc":1}',
RENAME '$.abc' = 'xyz',
SET '$.xyz' = 2)
Result:
{"xyz":2}
Note that the new field name is in effect at soon as operation
RENAME
finishes. It is visible to all subsequent operations,
such as SET
in this example.
These are the handlers allowed for operator RENAME
.
-
REPLACE ON EXISTING
(default). -
IGNORE ON MISSING
(default),ERROR ON MISSING
.
Parent topic: Oracle SQL Function JSON_TRANSFORM