Oracle XML类型解析问题
我的XML文件存储在oracle列中Oracle XML类型解析问题,oracle,extract,xmltype,Oracle,Extract,Xmltype,我的XML文件存储在oracle列中 标签 标签 违约 选通 白营自然保护区00 标签 标签 错误的 内部的 当我试图执行下面的查询时,我没有得到任何结果 从表中选择XMLTYPE(XMLDATA).EXTRACT('//productAttribute/name/text()).getStringVal() 我的查询出了什么问题欢迎来到XMLs世界中最烦人的“特性”——名称空间。由于XML文档中定义了名称空间,因此需要指定所选节点的名称空间。请注意,XML文档中有两个名称空间,因此需要使用
标签
标签
违约
选通
白营自然保护区00
标签
标签
错误的
内部的
当我试图执行下面的查询时,我没有得到任何结果
从表中选择XMLTYPE(XMLDATA).EXTRACT('//productAttribute/name/text()).getStringVal()
我的查询出了什么问题欢迎来到XMLs世界中最烦人的“特性”——名称空间。由于XML文档中定义了名称空间,因此需要指定所选节点的名称空间。请注意,XML文档中有两个名称空间,因此需要使用正确的名称空间。以下内容用作XML的PLSQL块:
set serveroutput on;
declare
v_xml varchar2(32767) := '<?xml version="1.0" encoding="UTF-8"?> <BasicProductTemplateType xmlns="http://www.asia.com/app/Product_2_0" xmlns:jBos_Common_1_0="http://www.asia.com/jBos/Common_1_0"> <jBos_Common_1_0:displayName> <jBos_Common_1_0:key>label</jBos_Common_1_0:key> </jBos_Common_1_0:displayName> <jBos_Common_1_0:description>label</jBos_Common_1_0:description> <jBos_Common_1_0:extensionProperty name="invoicingCoId" value="2"/> <jBos_Common_1_0:extensionProperty name="currencyCode" value="CNY"/> <jBos_Common_1_0:extensionProperty name="taxStatus" value="false"/> <productRatePlan> <name>Default</name> <selectionType>SELECTONE</selectionType> </productRatePlan> <productAttribute> <name>Baiying_attr_00</name> <displayName> <jBos_Common_1_0:key>Label</jBos_Common_1_0:key> </displayName> <type entityName="bmiasia.app.siulib.siu.common.StringSIU"/> <description> <jBos_Common_1_0:key>Label</jBos_Common_1_0:key> </description> <required>false</required> <source>INTERNAL</source> </productAttribute> </BasicProductTemplateType>';
v_xmltype xmltype;
begin
v_xmltype := xmltype.createxml(v_xml);
dbms_output.put_line(v_xmltype.EXTRACT('//productAttribute/name/text()', 'xmlns="http://www.asia.com/app/Product_2_0"').getStringVal());
end;
/
打开服务器输出;
声明
v_xml varchar2(32767):=“标签标签默认选择一个白音标签属性00标签标签假内部”;
v_xmltype xmltype;
开始
v_xmltype:=xmltype.createxml(v_xml);
dbms_output.put_line(v_xmltype.EXTRACT(“//productAttribute/name/text()”,“xmlns=”http://www.asia.com/app/Product_2_0“')。getStringVal());
终止
/
是的,它现在正在工作。。。。如果产品属性有多个节点,那么我可以在游标中获取输入并解析数据,以及更多信息吗?我们在产品属性节点中有多个节点,我想带数据样本代码是baying\u attr\u 03 false baying\u attr\u 04 false