2

I have a table with clob that contains JSON. The JSON already exists, I need to change the hierarchy of the first value.

This is the original json:

{
  "configurationByAssetType" :
  {
    "default" :
    {
      "sections" :
      [
....
]
}}}

I need to put configurationByAssetType under new section - configurationByView:

{
"configurationByView"
{
 "default" :{
  "configurationByAssetType" :
  {
    "default" :
    {
      "sections" :
      [
....
]
}}}}}

I want to copy all existing data to be under:

{
"configurationByView"
{
 "default" :{

1 Answer 1

1

Why just not to concatenate necessary characters to the beginning and end of the clob:

with q as
 (select to_clob('{  "configurationByAssetType" :
                {
                  "default" :
                  {
                    "sections" :
                    [
              ....
              ]
              }}}') clob_json
from dual) 
select '{
"configurationByView"
    {
  "default" :{' || clob_json || '}}}'
  from q;
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! This is the exactly what I thought also after I wrote the question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.