【发布时间】:2016-07-27 05:56:39
【问题描述】:
我在编写从表 (card_type) 中选择数据的查询时遇到困难。我只需要解析名称标签中包含“PARTNER_CD”的 xml 属性(EXT_PROPERTIES_XML)。下面是 xml 属性的示例。
<Properties>
<Property>
<Name>PARTNER_CD</Name>
<Value>LOBT</Value>
</Property>
<Property>
<Name>REJECT_AT_PUMP</Name>
<Value>true</Value>
</Property>
<Property>
<Name>MAX_LITRE</Name>
<Value>75</Value></Property>
</Properties>
<Properties>
<Property>
<Name>PARTNER_CD</Name>
<Value>PET1</Value>
</Property>
<Property>
<Name>REJECT_AT_PUMP</Name>
<Value>true</Value>
</Property>
<Property>
<Name>MAX_LITRE</Name>
<Value>75</Value></Property>
</Properties>
期望的输出:
NAME VALUE
-------------------------
PARTNER_CD LOBT
PARTNER_CD PET1
这是我试过的..
Select xmltype.createxml(EXT_PROPERTIES_XML).extract('/Properties/Property/Name/text()').getStringVal() as Name,
xmltype.createxml(EXT_PROPERTIES_XML).extract('/Properties/Property/Value/text()').getStringVal() as Value
from card_type
我得到的输出是:
Name Value
PARTNER_CDREJECT_AT_PUMPMAX_LITRE LOBTtrue75
非常感谢任何帮助。谢谢。
【问题讨论】: