Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

update xml to replace value

luanxiSep 21 2010 — edited Sep 22 2010
I have seen good example on how to use updateXML to update the value as the one below,
but no luck on search on how to replace from one value to another.

Does anyone have example on how to replace value using updateXML?

Thanks,
Luan



insert into XML_CLOB values ( xmltype(
'<student id="211">
<personal idPer="2561">
<firstName>John</firstName>
<middleName>Michael</middleName>
<lastName>Scott</lastName>
<birthday>15-11-1984</birthday>
<address>8600 Beverly Blvd.</address>
<city>Los Angeles, CA.</city>
<country>USA</country>
</personal>
<personal idPer="2561">
<firstName>John</firstName>
<middleName>Michael</middleName>
<lastName>Scott</lastName>
<birthday>15-11-1984</birthday>
<address>8600 Beverly Blvd.</address>
<city>Los Angeles, CA.</city>
<country>USA</country>
</personal>
<personal idPer="2221">
<firstName>John</firstName>
<middleName>Michael</middleName>
<lastName>Scott</lastName>
<birthday>15-11-1984</birthday>
<address>8600 Beverly Blvd.</address>
<city>Los Angeles, CA.</city>
<country>USA</country>
</personal>
</student>'));

prompt 'select object_value from xml_clob';

select object_value from xml_clob;

prompt 'update XML_CLOBset object_value = updateXML( object_value,/student/personal/city/text(),New York City)where existsNode(object_value,/student[@id="211"]) = 1';

update XML_CLOB
set object_value = updateXML
(
object_value,
'/student/personal/city/text()',
'New York City'
)
where existsNode(object_value,'/student[@id="211"= 1;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 20 2010
Added on Sep 21 2010
5 comments
3,473 views