我有一个如下所示的 xml。有许多节点 b4 和之后,但它们是无关紧要的。
<Parent>
<ServiceTag>sometag</ServiceTag>
<Addl_Payloads>
<Addl_PayloadCount>1</Addl_PayloadCount>
<Addl_Payload>
<Attrib Name="TYPE" Seq="1" Value="LICENSE"> </Attrib>
<Attrib Name="ENTITLEMENT_ID" Value="sdfsfdsadfaasdfsadf1"></Attrib>
</Addl_Payloads>
</Parent>
如何在 Oracle 11g 中构建查询以仅在存在Attrib name=ENTITLEMENT_ID
. 我试过这样的东西,但这让我的值列基本上是空的,read = 'sdfsfdsadfaasdfsadf1'
如果它存在的话
SELECT s.doc_id,
extractValue(x.column_value, '/Parent/ServiceTag') as ST,
extractValue(x.column_value,
'/Parent/Addl_Payloads/Addl_Payload/Attrib[@Name="ENTITLEMENT_ID"]') as Value
from LKMLOG.LKM_ORIG_ASB_MSG s
, TABLE(
XMLSequence(
xmltype( s.ASB_XML).extract(
'//Payload/PPIDInfoRequestMessage/PPIDData/Parent'
)
)
) x
where s.doc_id in (somevalues);