ORA-19228:XPST0008 - oracle sql中未声明的标识符

时间:2015-09-24 10:41:55

标签: sql oracle xml-parsing xml-namespaces

我有xml字符串,我在下面提到过,我想从xml字符串中提取代码。我在下面写了选择查询以从<ax2140:code>0</ax2140:code>中提取0的值,但我收到错误

ORA-19228: XPST0008 - undeclared identifier: prefix 'ax2140' local-name 'ax2140:code'
19228. 00000 -  "XPST0008 - undeclared identifier: prefix '%s' local-name '%s'"

这是我的xml字符串 -

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <ns:placeShopOrderResponse xmlns:ns="http://service.soap.CDRator.com">
         <ns:return xmlns:ax2127="http://data.soap.CDRator.com/xsd" 
         xmlns:ax2129="http://webshop.data.soap.CDRator.com/xsd" 
         xmlns:ax2130="http://core.data.soap.CDRator.com/xsd" 
         xmlns:ax2133="http://signup.data.soap.CDRator.com/xsd" 
         xmlns:ax2134="http://core.signup.data.soap.CDRator.com/xsd" 
         xmlns:ax2139="http://result.service.soap.CDRator.com/xsd" 
         xmlns:ax2140="http://core.result.service.soap.CDRator.com/xsd" 
         xmlns:ax2147="http://webshop.result.service.soap.CDRator.com/xsd" 
         xmlns:ax2148="http://mandate.result.service.soap.CDRator.com/xsd" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax2147:PlaceShopOrderResultDTO">
            <ax2130:id xsi:nil="true" />
            <ax2140:code>0</ax2140:code>
            <ax2140:description>OK</ax2140:description>
               <ax2127:statusId>1</ax2127:statusId>
               <ax2127:subscriptionCondition xsi:type="ax2127:SubscriptionStatusDTO">
                  <ax2130:id xsi:nil="true" />
                  <ax2140:code>0</ax2140:code>
                  <ax2140:description>OK</ax2140:description>
                  <ax2130:imsi xsi:nil="true" />
                  <ax2130:phoneNumber>NO_NUMBER</ax2130:phoneNumber>
                  <ax2127:imei xsi:nil="true" />
                  <ax2127:simCard xsi:nil="true" />
               </ax2127:teleService>
            </ax2147:subscriptions>
         </ns:return>
      </ns:placeShopOrderResponse>
   </soapenv:Body>
</soapenv:Envelope>

这是我的选择查询:

SELECT ID,xt_code.CODE
FROM TEMP_SOAP_MONITORING_MSP sm
CROSS JOIN XMLTable(XMLNAMESPACES (
      'http://core.result.service.soap.CDRator.com/xsd' as "ax2140_code"
    ),
    'for $i in //ax2140:code return $i'
    passing XMLType(sm.RESPONSE_XML)
    columns "CODE" VARCHAR2(50) path '/') xt_code;

1 个答案:

答案 0 :(得分:1)

在查询中使用"ax2140"代替"ax2140_code"