Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 用于多个节点的Xquery替换语句_Sql_Replace_Db2_Xquery - Fatal编程技术网

Sql 用于多个节点的Xquery替换语句

Sql 用于多个节点的Xquery替换语句,sql,replace,db2,xquery,Sql,Replace,Db2,Xquery,DB2表中的此列(名为docum_xml)具有如下xml结构: <member> <client1> <phone>510-000-0001</phone> </client1> <client2></client2> <client3> <phone>510-000-0002</phone&

DB2表中的此列(名为docum_xml)具有如下xml结构:

    <member>
      <client1>
         <phone>510-000-0001</phone>
      </client1>
      <client2></client2>
      <client3>
         <phone>510-000-0002</phone>
      </client3>
      ...
    </member>
但它给了我一个错误的说法: SQL16003N当上下文中需要数据类型“item()”时,不能使用数据类型为“(item(),item()+)”的表达式

我意识到它出错了,因为我试图更新多个节点,所以我认为这里可能需要一个for循环。但是我一直在构造for循环,并将正确的数据返回到我的DB2列。有人能帮我吗

谢谢!
Stella

尝试在修改中使用此选项:

for $phone in $new//phone
return 
    replace value of node $phone
    with fn:replace($phone,''-'','''')

更新TABLENAME set DOCUM_XML=XMLQUERY('transform copy$new:=$documxml modify(对于$phone in$new//phone返回将节点$phone的值替换为fn:replace($phone,'-'','',''))返回$new'将DOCUM_XML传递为“documxml”);我试过这个,但由于语法错误,它出错了。我哪里做错了?
for $phone in $new//phone
return 
    replace value of node $phone
    with fn:replace($phone,''-'','''')