我有一个包含 JSON 的 clob 表。 JSON 已经存在,我需要更改第一个值的层次结构。
这是原始的json:
{
"configurationByAssetType" :
{
"default" :
{
"sections" :
[
....
]
}}}
我需要将 configurationByAssetType 放在新部分 - configurationByView 下:
{
"configurationByView"
{
"default" :{
"configurationByAssetType" :
{
"default" :
{
"sections" :
[
....
]
}}}}}
我想将所有现有数据复制到:
{
"configurationByView"
{
"default" :{
答案 0 :(得分:1)
为什么不将必要的字符连接到 clob 的开头和结尾:
with q as
(select to_clob('{ "configurationByAssetType" :
{
"default" :
{
"sections" :
[
....
]
}}}') clob_json
from dual)
select '{
"configurationByView"
{
"default" :{' || clob_json || '}}}'
from q;