Skip to content
Advertisement

Adding elements in the end to a json array of objects in Oracle

I have a json column named “configuration” in an Oracle database with a data like-

How can add elements to the “sections” array inside the CLOB? for example, add this object to the CLOB- {“active”:false, “code”:”page.body”}

I tried to do this-

but I got this error- Error report – SQL Error: ORA-00917: missing comma 00917. 00000 – “missing comma” *Cause:
*Action:

Thanks!

Advertisement

Answer

You can create the function:

Then you can update the table:

Then:

Outputs:

CONFIGURATION
{“sections”:[{“active”:true,”code”:”page.about”},{“active”:true,”code”:”page.title”},{“active”:false,”code”:”page.body”}]}

db<>fiddle here

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement