Results 1 to 2 of 2

Thread: sql/xml help

  1. #1
    Join Date
    Apr 2010
    Posts
    3

    Unanswered: sql/xml help

    Hello, I am new to to DB2 and am stuck on a simple query. I have a table that contains some columns, one of which is an XML datatype.

    I am using DB2-express c v9.7

    When doing the below simple xquery through the control center

    xquery
    transform
    copy $mycust := db2-fn:sqlquery('select XmlFile from table')
    modify
    do replace $mycust//DataNode/text()
    with "newText"
    return $mycust

    it does in fact return properly. But when I try to incorporate it into a sql update statement such as

    update table
    SET XmlFile = xquery (
    transform
    copy $mycust := $c
    modify do replace $mycust//DataNode/text()
    with "newText"
    return $mycust
    passing XmlFile as "c"
    )

    I get an error message stating:

    SQL0104N An unexpected token "copy $mycust := $c modify do replace $myc" was found following "= xquery ( transform". Expected tokens may include: "<space>".

    I have gone back and forth, verifying syntax, typos, and still have not been able to locate the problem. Can someone help?

    Thanks

  2. #2
    Join Date
    Apr 2010
    Posts
    3
    Figured it out apparently, I wasn't looking at the samples carefully enough... it should have read xmlquery(.... instead of xquery(...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •