PLSQL to update a node in xmltype

Asked

Viewed 38 times

1

I have to update a column in format xmltype of an Oracle database.

Basically I just do update of property valor if another property of that node date and time are equal. That is, in the code below, I just do update in the node QUAD02 and value VALOR12TIND where the time is 10:12:52

<QUAD02 data="18.08.20" utilizador="30768">
    <VALOR71 titulo="N." valor="2"/>
    <VALOR72 titulo="Data" valor="18.08.20"/>
    <VALOR73 titulo="Hora" valor="10:12:52"/>
    <VALOR12TIND titulo="uuu" valor=""/>
</QUAD02>
<QUAD02 data="18.08.20" utilizador="30768">
    <VALOR71 titulo="N." valor="2"/>
    <VALOR72 titulo="Data" valor="18.08.20"/>
    <VALOR73 titulo="Hora" valor="10:15:52"/>
    <VALOR12TIND titulo="uuu" valor=""/>     
</QUAD02>

The query I used was:

update doc_g po set grelha = updatexml( grelha, 'GRELHA/quad/VALOR12TIND"/@valor' ,"ssss")
where xmlexists('$p/GRELHA/quad02/VALOR73 [@valor="10:12:52"]' passing po.grelha as "p"

The example comes from a query I do in Java. Do you have any idea how to proceed?

  • Good morning! I went to make a test in plsql here and gave an error when parsing your xml, Validei xml by www.xmlvalidation.com and there is an error in line 7, is this same xml?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.