With Database Actions (SQL Developer Web), it's quite easy to click on the 'New JSON Document' button to add a new JSON document to the collection.
The collection of course is actually a table in Oracle, and the table itself has a number of columns:
I have created modules in ORDS with PL/SQL handlers. While I am able to update JSON documents here by using
UPDATE "Collection" SET json_document = '{"key": "value"}' WHERE JSON_VALUE(json_document, '$.id') = :id'
I am not able to add a new document easily with
INSERT INTO "Collection" (json_document) VALUES ('{"key": "value"}')
because the id
is set as a PK column and must be specified. How might I use PL/SQL to add a new document with auto generated fields elsewhere? Or should I use SODA for PL/SQL to achieve this only?
Thanks!