xml - plsql updatexml- can't update value based on attribute -
i'm working database oracle 11g, , has xml fields like:
<bookstore id="other"> <fractionofbooks>1.0</fractionofbooks> </bookstore> <bookstore id="main"> <fractionofbooks>0.0</fractionofbooks> </bookstore> <bookstore id="small"> <fractionofbooks>0.0</fractionofbooks> </bookstore>
so need change fraction id="other" 0.0, , id="main" 1.0.
i'm doing 2 queries, first do:
update db.mytable set xml = updatexml( xml, '/*:bookstore/[@name="other"]/*:fractionofbooks', 0.0 )
oddly, if select record, resulting xml has missing last tag, becomes:
<bookstore id="other">0</bookstore> <bookstore id="main"> <fractionofbooks>0.0</fractionofbooks> </bookstore> <bookstore id="small"> <fractionofbooks>0.0</fractionofbooks> </bookstore>
i don't think it's nice solution set value including tag, can me figure out wrong?
thanks
i miss text() function after last node: updating node instead of contents. see:
http://docs.oracle.com/cd/b19306_01/server.102/b14200/functions205.htm
Comments
Post a Comment