簡體   English   中英

如何更新xml列中的特定節點

[英]How can I update a specific node in a xml column

我的表[fixed_width_export_specification_t] [specification_xml]中存儲了以下數據

<fixed_width_metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <fixed_width_metadata_row>
    <rowtype>sys_header</rowtype>
    <dbname>sys_nm_label</dbname>
    <width>56</width>
    <fillleftright>right</fillleftright>
  </fixed_width_metadata_row>
  <fixed_width_metadata_row>
    <rowtype>remit1</rowtype>
    <dbname>remit_column1</dbname>
    <width>32</width>
    <fillleftright>right</fillleftright>
  </fixed_width_metadata_row>
</fixed_width_metadata>

我想將rowtype等於remit1並且dbname等於remit_column1的寬度從32更新為61

我玩着不同的查詢直到無濟於事。 我不知道如何隔離想要的元素,即寬度,然后隨后更新其值。

update fixed_width_export_specification_t
set specification_xml.modify
  ('replace value of (/fixed_width_metadata/
                        fixed_width_metadata_row
                         [rowtype = "remit1" and dbname = "remit_column1"]/
                          width/text())[1] 
      with 61 ')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM