xml是:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:abcs="http://www.avea.com.tr/om/ABCS_BSCS_ASSET_OPERATIONS" xmlns:ave="http://www.avea.com.tr/AveaFrameWork" xmlns:ebs="http://www.avea.com.tr/om/EBS_COMMITMENT_ASSET_OPERATIONS"><soapenv:Header/><soapenv:Body><ebs:EbsRetrieveProbableCommitmentPenaltiesResponse>
<ave:ResponseHeader>
<ave:RequestId>
<!--Optional:-->
<ave:GUID>?</ave:GUID>
<!--Optional:-->
<ave:ListOfTransId>
<!--Zero or more repetitions:-->
<ave:TransId>
<ave:SystemName>?</ave:SystemName>
<ave:ExtendedValue>?</ave:ExtendedValue>
</ave:TransId>
</ave:ListOfTransId>
</ave:RequestId>
<!--Optional:-->
<ave:TimeStampDateTime>?</ave:TimeStampDateTime>
<!--Optional:-->
<ave:ElapsedTime>?</ave:ElapsedTime>
</ave:ResponseHeader>
<!--Optional:-->
<abcs:ResponseBody>
<!--Optional:-->
<abcs:listOfCommitmentPenalty>
<!--Zero or more repetitions:-->
<abcs:commitmentPenalty>
<!--Optional:-->
<abcs:commitmentName>asddsfdsf dsfsdf</abcs:commitmentName>
<!--Optional:-->
<abcs:startDate>2014-11-12T16:06:05.664+02:00</abcs:startDate>
<!--Optional:-->
<abcs:endDate>2015-11-12T16:06:05.664+02:00</abcs:endDate>
<!--Optional:-->
<abcs:totalPeriod>365</abcs:totalPeriod>
<!--Optional:-->
<abcs:remainingPeriod>120</abcs:remainingPeriod>
<!--Optional:-->
<abcs:penaltyAmount>1200</abcs:penaltyAmount>
</abcs:commitmentPenalty>
<abcs:commitmentPenalty>
<!--Optional:-->
<abcs:commitmentName>asdasd asdasd</abcs:commitmentName>
<!--Optional:-->
<abcs:startDate>2013-04-10T16:06:05.664+02:00</abcs:startDate>
<!--Optional:-->
<abcs:endDate>2015-04-10T16:06:05.664+02:00</abcs:endDate>
<!--Optional:-->
<abcs:totalPeriod>720</abcs:totalPeriod>
<!--Optional:-->
<abcs:remainingPeriod>30</abcs:remainingPeriod>
<!--Optional:-->
<abcs:penaltyAmount>500</abcs:penaltyAmount>
</abcs:commitmentPenalty>
</abcs:listOfCommitmentPenalty>
<!--Optional:-->
<abcs:totalPenaltyAmount>1700</abcs:totalPenaltyAmount>
</abcs:ResponseBody>
<!--Optional:-->
<ave:ResultStatus>
<ave:resultCode>0</ave:resultCode>
<!--Optional:-->
<ave:resultMessageList>
<!--Zero or more repetitions:-->
<ave:resultMessage>
<!--Optional:-->
<ave:resultMessageId>?</ave:resultMessageId>
<!--Optional:-->
<ave:resultMessageSubId>?</ave:resultMessageSubId>
<!--Optional:-->
<ave:resultStringCode>?</ave:resultStringCode>
<!--Optional:-->
<ave:resultDescription>?</ave:resultDescription>
</ave:resultMessage>
</ave:resultMessageList>
<!--Optional:-->
<ave:KeyValuePairList>
<!--Zero or more repetitions:-->
<ave:KeyValuePair>
<!--Optional:-->
<ave:key>?</ave:key>
<!--Optional:-->
<ave:value>?</ave:value>
<!--Optional:-->
<ave:data_type>?</ave:data_type>
</ave:KeyValuePair>
</ave:KeyValuePairList>
</ave:ResultStatus>
</ebs:EbsRetrieveProbableCommitmentPenaltiesResponse></soapenv:Body></soapenv:Envelope>
Sql:
select atts.att1,atts.att2,my_table.PL_IN
from my_table
, xmltable(
xmlnamespaces(
'http://schemas.xmlsoap.org/soap/envelope/' as "soapenv"
, 'http://www.avea.com.tr/om/ABCS_BSCS_ASSET_OPERATIONS' as "abcs"
, 'http://www.avea.com.tr/AveaFrameWork' as "ave"
,'http://www.avea.com.tr/om/EBS_COMMITMENT_ASSET_OPERATIONS' as "ebs")
,'/soapenv:Envelope/soapenv:Header/soapenv:Body/abcs:ResponseBody/abcs:listOfCommitmentPenalty/abcs:commitmentPenalty'
passing xmltype(my_table.PL_IN)
columns
att1 varchar2 (20) path 'abcs:commitmentName',
att2 number path 'abcs:totalPeriod') atts
我试图在oracle中解析clob xml数据没有行返回。在sql我定义名称空间和解析xml,但它不起作用。我已经尝试了几乎所有我在Google上完成的解决方案,但事实并非如此。是否有人可以帮助我或任何人建议这个问题。感谢。
答案 0 :(得分:0)
您的XPath不正确。 soapenv:Body
与soapenv:Header
处于同一级别,这是一个空标记。您还错过了身体顶部的ebs:EbsRetrieveProbableCommitmentPenaltiesResponse
节点。
所以XPath应该开始:
'/soapenv:Envelope/soapenv:Body/ebs:EbsRetrieveProbableCommitmentPenaltiesResponse/abcs:ResponseBody/...
只需更改您的查询:
ATT1 ATT2 PL_IN
-------------------- ---------- --------------------------------------------------------------------------------
asddsfdsf dsfsdf 365 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmln
asdasd asdasd 720 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmln