I have following xml struct in pl/sql:
<struct>
<member>
<name>CODE</name>
<value>
<integer>0</integer>
</value>
</member>
<member>
<name>MSG</name>
<value>
<string>Some message</string>
</value>
</member>
</struct>
How can i extract values in path /member/value/some_type using text in name tag? I mean something like this:
extract('//member/value/*[filter name tag = CODE]').getStringValue
You can achieve this using local-name()
XPath should be,
//member/value/*[local-name()='CODE']
//member/value/*[local-name()='integer']
//member/value/*[local-name()='string']
In this case, you XPath should be
//member[*='CODE']/*/*
//member[*='MSG']/*/*
The short answer is you don't treat databases as ETL (extract,transform,load) tools. What you want to do is pass this XML file to a separate program that uses XPath and process it that way. Databases are only supposed to store data. In fact I have spent the past 5 months removing "exotic " code like this that made an Oracle database take 72+ hours to insert 400k rows. So again offset this to xpath
The query will look almost identical to your command above
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.