在 Oracle 中通过 SQL 查询更改 JSON 层次结构
Change JSON hierarchy by SQL query in Oracle
我有一个 table 和包含 JSON 的 clob。 JSON 已经存在,我需要更改第一个值的层次结构。
这是原文json:
{
"configurationByAssetType" :
{
"default" :
{
"sections" :
[
....
]
}}}
我需要将 configurationByAssetType 放在新部分下 - configurationByView:
{
"configurationByView"
{
"default" :{
"configurationByAssetType" :
{
"default" :
{
"sections" :
[
....
]
}}}}}
我想将所有现有数据复制到以下位置:
{
"configurationByView"
{
"default" :{
为什么不将必要的字符连接到 clob 的开头和结尾:
with q as
(select to_clob('{ "configurationByAssetType" :
{
"default" :
{
"sections" :
[
....
]
}}}') clob_json
from dual)
select '{
"configurationByView"
{
"default" :{' || clob_json || '}}}'
from q;
我有一个 table 和包含 JSON 的 clob。 JSON 已经存在,我需要更改第一个值的层次结构。
这是原文json:
{
"configurationByAssetType" :
{
"default" :
{
"sections" :
[
....
]
}}}
我需要将 configurationByAssetType 放在新部分下 - configurationByView:
{
"configurationByView"
{
"default" :{
"configurationByAssetType" :
{
"default" :
{
"sections" :
[
....
]
}}}}}
我想将所有现有数据复制到以下位置:
{
"configurationByView"
{
"default" :{
为什么不将必要的字符连接到 clob 的开头和结尾:
with q as
(select to_clob('{ "configurationByAssetType" :
{
"default" :
{
"sections" :
[
....
]
}}}') clob_json
from dual)
select '{
"configurationByView"
{
"default" :{' || clob_json || '}}}'
from q;