我有以下xml值,它存储在request_xml列中,它是clob数据类型:
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:updateRechargeTicketResponse xmlns:ns="http://service.soap.CDRator.com">
<ns:return xmlns:ax232="http://core.result.service.soap.CDRator.com/xsd" xmlns:ax233="http://core.data.soap.CDRator.com/xsd" xmlns:ax230="http://payment.result.service.soap.CDRator.com/xsd" xmlns:ax228="http://data.soap.CDRator.com/xsd" xmlns:ax231="http://result.service.soap.CDRator.com/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax230:RechargeTicketResultDTO">
<ax233:id xsi:nil="true"/>
<ax232:code>0</ax232:code>
<ax232:description>SOAP_GLOBAL_SUCCESS</ax232:description>
<ax232:serviceUser xsi:nil="true"/>
<ax232:success>true</ax232:success>
<ax232:translationTag>SOAP_GLOBAL_SUCCESS</ax232:translationTag>
<ax230:rechargeTicket xsi:type="ax228:RechargeTicketDTO">
<ax233:id>201505131421267777</ax233:id>
<ax233:billingGroupId>201505071857272816</ax233:billingGroupId>
<ax233:code>BALANCE_DIRECTDEBIT</ax233:code>
<ax233:dateCreated>2015-05-13</ax233:dateCreated>
<ax233:dayOfMonth>0</ax233:dayOfMonth>
<ax233:nextRechargeDate xsi:nil="true"/>
<ax233:rechargeAmount>10.0</ax233:rechargeAmount>
</ax230:rechargeTicket>
</ns:return>
</ns:updateRechargeTicketResponse>
</soapenv:Body>
</soapenv:Envelope>
我想从中提取值。我使用了以下查询,但它没有返回任何内容。我收到错误
ORA-19228: XPST0008 - undeclared identifier: prefix 'ax230' local-name 'ax230:rechargeTicket'
19228. 00000 - "XPST0008 - undeclared identifier: prefix '%s' local-name '%s'"
这是我的查询
SELECT ID,CREATE_DATE,WEB_SERVICE_NAME,WEB_METHOD_NAME,xt_billingGroupId.BILLING_GROUP_ID,xt_error_code.ERROR_CODE,xt_error_message.ERROR_DESCRIPTION,xt_code.CODE,xt_rec_id.RECHARGE_TICKET_ID
FROM TEMP_SOAP_MONITORING_TOPUP sm
CROSS JOIN XMLTable(XMLNAMESPACES (
'http://schemas.xmlsoap.org/soap/envelope/' AS "soapenv",
'http://service.soap.CDRator.com' as "ns",
'http://core.data.soap.CDRator.com/xsd' as "ax2130",
'http://webshop.result.service.soap.CDRator.com/xsd' as "ax2147",
'http://core.signup.data.soap.CDRator.com/xsd' as "ns3",
'http://service.soap.CDRator.com' as "ns5",
'http://core.data.soap.CDRator.com/xsd' as "ax233",
'http://core.result.service.soap.CDRator.com/xsd' as "ax232"
),
'for $i in //*:billingGroupId return $i'
passing XMLType(sm.REQUEST_XML)
columns "BILLING_GROUP_ID" VARCHAR2(100) path '/') xt_billingGroupId
CROSS JOIN XMLTable(XMLNAMESPACES (
'http://core.result.service.soap.CDRator.com/xsd' as "ax232"
),
'for $i in //ax232:code return $i'
passing XMLType(sm.RESPONSE_XML)
columns "ERROR_CODE" VARCHAR2(100) path '/') xt_error_code
CROSS JOIN XMLTable(XMLNAMESPACES (
'http://core.result.service.soap.CDRator.com/xsd' as "ax232"
),
'for $i in //ax232:description return $i'
passing XMLType(sm.RESPONSE_XML)
columns "ERROR_DESCRIPTION" VARCHAR2(200) path '/') xt_error_message
CROSS JOIN XMLTable(XMLNAMESPACES (
'http://core.result.service.soap.CDRator.com/xsd' as "ax232"
),
'for $i in //*:code return $i'
passing XMLType(sm.REQUEST_XML)
columns "CODE" VARCHAR2(100) path '/') xt_code
CROSS JOIN XMLTable(XMLNAMESPACES (
'http://core.data.soap.CDRator.com/xsd' as "ax233"
),
'for $i in //ax230:rechargeTicket return $i'
passing XMLType(sm.RESPONSE_XML)
columns "RECHARGE_TICKET_ID" VARCHAR2(200) path 'ax233:id') xt_rec_id
答案 0 :(得分:2)
您的命名空间与源XML和查询不匹配
'http://data.soap.CDRator.com/xsd' as "ax233"
VS
xmlns:ax233="http://core.data.soap.CDRator.com/xsd"
尝试从您的来源中删除core.
或将core.
添加到XMLNAMESPACES
的{{1}}。
修复错误:
ax233
您缺少ax230的名称空间声明,因此需要添加XMLNAMESPACES:
ORA-19228: XPST0008 - undeclared identifier: prefix 'ax230' local-name 'ax230:rechargeTicket'
19228. 00000 - "XPST0008 - undeclared identifier: prefix '%s' local-name '%s'"
如果查询格式更好,您可能也会发现它更容易(除非您有理由按照自己的方式进行)。有关示例,请参阅以下内容:
'http://payment.result.service.soap.CDRator.com/xsd' as "ax230",