Open
Description
The following statement causes parser errors:
update dept_dv v
set v.data = json_transform(
v.data,
set '$.street' = '85 Albert Embankment',
nested '$.emps[*]' (
set '@.sal' = path '@.sal * 42'
),
nested '$.emps[*]?(@.ename == "BOND")' (
set '@.sal' = path '@.sal + 1',
append '@.tools' = 'Aston Martin DB5'
)
)
where v.data."_id".numberOnly() = 50;
The set operation was not fully documented in SQL Language Reference for 23c as of December 2023. The path
keyword was missing.
The following statement works without the path
keyword (and therefore using a literal instead of a JSON path):
update dept_dv v
set v.data = json_transform(
v.data,
set '$.street' = '85 Albert Embankment',
nested '$.emps[*]' (
set '@.sal' = 10
),
nested '$.emps[*]?(@.ename == "BOND")' (
set '@.sal' = 20,
append '@.tools' = 'Aston Martin DB5'
)
)
where v.data."_id".numberOnly() = 50;
Documentation was fixed in May 2024. See https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/JSON_TRANSFORM.html#GUID-DD2A821B-C688-4310-81B5-5F45090B9366__GUID-1BBA7230-9695-482E-B686-BADB0724F307 . Therefore I assign the label 23.4