update ibmcom.docstore set language = XMLCAST ( XMLQUERY('$c/externalMetaData/field[@name="Language"]/text()' passing EXTERNAL_METADATA as "c") AS VARCHAR(5))
Note that this script extracts XML node from XML field, which in my case looks similar to this:
<externalMetaData><field name="ContentType">text/html</field><field name="docid">http://www.blablabla.com/support?uid=2414412</field><field name="documentSource">pushAPI</field><field name="Language">en</field><field name="keywords">websphere</field><field name="Charset">UTF-8</field><field name="scopes">my</field></externalMetaData>
The language field is then extracted from XML and stored in appropriate column. The real trick is in the XMLCAST function, as if you do not use it, the UPDATE statement will fail.
No comments:
Post a Comment