我必须得到 2 个字符串之间的值。SUBSCRIPTION_ID
应该总是返回一个数字。ORDER_TYPE
返回字母,特殊字符。ORDER_NUMBER
总是返回一个数字。我正面临获得正确的问题ORDER_TYPE
。我不知道为什么,但是 2 个字符串之间的一些值ORDER_TYPE
显示为 null,这不是 null。问题只是因为 .+ , \d 这是错误的,我试图从中追加。这是我的完整我试图从中提取 2 个字符串之间的值的 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:ax2133="http://signup.data.soap.CDRator.com/xsd" xmlns:ax2134="http://core.signup.data.soap.CDRator.com/xsd" 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:ax2140="http://core.result.service.soap.CDRator.com/xsd" xmlns:ax2139="http://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><ax2130:description></ax2130:description><ax2130:stat>No Active BDM</ax2130:stat></ax2127:bdmStatus><ax2127:warningLogContent></ax2127:warningLogContent></ax2127:subscriptionCondition><ax2127:teleService xsi:type="ax2127:TeleServiceDTO"><ax2130:id>201501070917439768</ax2130:id><ax2130:code>TELE</ax2130:code><ax2127:serviceStatus xsi:type="ax2127:StatusDTO"><ax2130:id>100</ax2130:id><ax2130:description>Neu</ax2130:description><ax2130:stat>New</ax2130:stat></ax2127:serviceStatus><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 TEMP_SOAP_MONITORING."ID", TO_NUMBER(REPLACE(REPLACE(REGEXP_SUBSTR(RESPONSE_XML,'<ax2147:subscriptions xsi:type="ax2127:SubscriptionDTO"><ax2130:id>\d+</ax2130:id>'),
'<ax2147:subscriptions xsi:type="ax2127:SubscriptionDTO"><ax2130:id>',''),'</ax2130:id>',''))
AS SUBSCRIPTION_ID ,
CAST(REPLACE(REPLACE(
REGEXP_SUBSTR(REQUEST_XML,'<ns7:orderType>.+</ns7:orderType>'),'<ns7:orderType>',''),'</ns7:orderType>','')
AS VARCHAR(100)) AS ORDER_TYPE,
TO_NUMBER(REPLACE(REPLACE(REGEXP_SUBSTR(RESPONSE_XML,'<ax2147:orderNumber>\d+</ax2147:orderNumber>'),'<ax2147:orderNumber>',''),'</ax2147:orderNumber>',''))
AS ORDER_NUMBER
FROM
TEMP_SOAP_MONITORING;