oracle更新xml节点的细节

在xml中遇到节点是空的,这个样子<name/>

然后我在网上找了很久总算找到解决方案了,顺便吐槽一下,网上的sql语句居然都是错的

一般的更新语句,适用于<name></name>

update table1 t set t.xml=updatexml(t.xml,'/data/dataTwo/name/text()',
'value'
)
where 1=1;

<name/>这种情况的语句为

update table1 t set t.xml=updatexml(t.xml,'/data/dataTwo/name',
'<name>' || 'value' || '</name>'
)
where 1=1;

  

 

posted @ 2018-05-10 10:19  OnceEnough  阅读(299)  评论(0编辑  收藏  举报