PLSQL 把多个字段转为json格式
Select cc.bm, cc.xm, json_arrayagg(cc.hb) jg
From (Select aa.bm, aa.xm, json_object(aa.ksbh, aa.wjmc) hb
From (Select '001' bm, '老六' xm, '0001' ksbh, '文具盒' wjmc
From dual t
Union All
Select '001' bm, '老六' xm, '0002' ksbh, '毛笔' wjmc
From dual t
Union All
Select '001' bm, '老六' xm, '0003' ksbh, '铅笔' wjmc
From dual t) aa) cc
Group By cc.bm, cc.xm
json_object,把参数转换为json格式
json_arrayagg 把多个json,拼接到一起