我有一个来自crmod(oracle crm on demand)的xml文件,想要提取记录数。 (即17680)通过查询表。我可以在xml中提取其他标签接受记录计数。有人能指出正确的方向
<ListOfAllotmentUsage xmlns="urn:/crmondemand/xml/AllotmentUsage/Data" recordcount="17680" lastpage="false">
亲切的问候
莱昂
答案 0 :(得分:0)
您应该使用@
来指定属性。
使用XMLTABLE,
SELECT *
FROM xmltable(
xmlnamespaces(DEFAULT 'urn:/crmondemand/xml/AllotmentUsage/Data'),'ListOfAllotmentUsage'
passing xmltype('<ListOfAllotmentUsage xmlns="urn:/crmondemand/xml/AllotmentUsage/Data" recordcount="17680" lastpage="false"></ListOfAllotmentUsage>')
columns
rec_count NUMBER path '@recordcount'
);
使用EXTRACTVALUE,
SELECT extractvalue(
xmltype('<ListOfAllotmentUsage xmlns="urn:/crmondemand/xml/AllotmentUsage/Data" recordcount="17680" lastpage="false"></ListOfAllotmentUsage>'),
'ListOfAllotmentUsage/@recordcount',
'xmlns="urn:/crmondemand/xml/AllotmentUsage/Data"'
)
FROM dual;