Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Create table with a CLOB column and default value of {} (Oracle 19c)

John WalkerDec 5 2022

If posted in the wrong area please forgive me -
I am trying to create a table that will have a CLOB column that will contain a JSON object. In my testing I have been working with -
UPDATE [table_name]
SET [col_name] = JSON_MERGEPATCH([col_name],'{"product_id":301}}')
where inventory_id = 100;
This update works fine if the if CLOB column already has something in it (ie {}). However, I have learned it will not update the column if there is nothing there. So I was trying to update my table create and set the default value for the column to be '{}'.
snippet from table create - ,[col_name] CLOB DEFAULT '{}'
I have tried '{{}}' and {{}} but neither worked
I cannot figure out how to pass in {} as the default value. Can anyone help??
Thank you in advance...

This post has been answered by Frank Kulash on Dec 5 2022
Jump to Answer
Comments
Post Details
Added on Dec 5 2022
9 comments
16,893 views