Hi,
Below is the XML and there are repeating nested nodes like PD1 below. I have to modify the attributes in the repeating nodes when a text value matches some string. for example update PD1_UPC_CASE (@Error_Flag = Y and @Error_Msg) when xpath (/ROWSET/ROW/XML_DATA/PH1/PD1/PD1_UPC_CASE/text() = "000000000000"). Extractvalue does not work for repeated nodes and below XML update is not working.
The below update is updating all attributes for the node PD1_UPC_CASE which is incorrect. Could some one help me in identifying the correct node and update accordingy
update xml_doc
set xml_data =
xmlquery(
'copy $d := $x modify ( for $i in $d/ROWSET/ROW/XML_DATA/PH1/PD1[PD1_COUNT="202"][PD1_UPC_CASE = "000000000000"]
return ( replace value of node $i/@Error_Flag with "Y"
)
)
return $d'
passing xml_data as x
returning content
)
where xmlexists('/ROWSET/ROW/XML_DATA/PH1/PD1[PD1_COUNT="202"][PD1_UPC_CASE = "000000000000"]' passing xml_data)
and file_id = 11973809 AND seq_num = 53650;