I have an "xml document" stored in a clob column. What db2 functions do I execute to parse the xml document into rpg variables? I've been playing around with xmltable but it seems to want the column your selecting to be of type xml instead of clob. Even when I run a modified example from https://www.ibm.com/developerworks/d...ola/index.html i get an error I do not know how to resolve:
The error I get is SQL 16011 result contains atomic value.
I was hoping to use the db2 functions but I may switch to xml-into.
PHP Code:
select x.*
from
xmltable(
'$d/dept/employee' passing
'<dept bldg="114">
<employee id="903">
<name>
<first>Mary</first>
<last>Jones</last>
</name>
<office>415</office>
<phone>905-403-6112</phone>
<phone>647-504-4546</phone>
<salary currency="USD">64000</salary>
</employee>
</dept>' as "d"
columns
empID INTEGER PATH '@id',
firstname VARCHAR(20) PATH 'name/first',
lastname VARCHAR(25) PATH 'name/last'
) as x
;
I was hoping to use the db2 functions but I may switch to xml-into.
Comment