[英]extract contents of xml file
我有一个来自 crmod(oracle crm on demand)的 xml 文件,并想提取记录计数。 (即 17680)通过查询进入一个表。 我可以在 xml 中提取其他标签接受记录计数。 有人可以指出正确的方向吗
<ListOfAllotmentUsage xmlns="urn:/crmondemand/xml/AllotmentUsage/Data" recordcount="17680" lastpage="false">
亲切的问候
莱昂
您应该使用@
来指定属性。
使用 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;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.