Skip to content
Advertisement

How to use Oracle XMLTable to retrieve the value/condition inside a tag?

I have a SQL using XMLTable to retrieve tag values such as Tag>Value</Tag which works fine. But what about value/condition inside the tag? See following XML with tag T2 having a remove condition = true. How can I retrieve that condition using XMLTable?

Advertisement

Answer

Pretty much the same way, just use the XPath syntax to match attributes. Leaving out namespaces for the illustration below (to keep it simple):

Note that in Oracle SQL there are no boolean values, so you can only retrieve this as a string, not a Boolean. If you need it in a condition, you can’t say where REMOVE; you will need to write where REMOVE = 'true'

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement