开发者

Parse XML string stored on Oracle Table

开发者 https://www.devze.com 2023-02-04 22:47 出处:网络
I\'ve a XML string like that stored on my DB: <?xml version=\"1.0\" encoding=\"utf-8\"?> <AddressMaintenance>

I've a XML string like that stored on my DB:

<?xml version="1.0" encoding="utf-8"?>
<AddressMaintenance>
<Label Name="lblAddress11">Address Line 1</Label><TextBox Name="txtAddress11">Zuellig Korea</TextBox>
</AddressMaintenance>

do you know if there is a way to extract the value Zuelling Korea using XMLQuery or SQL? I can't create a temporary table because it's a validate environment so I can only read开发者_开发技巧 that value. I know is possible using reg exp, but, if possible I try to use XML.

thanks,

Andrea


If this is stored in an XMLTYPE on a table you can use the Oracle XML functions to extract it using XPath:

SELECT
  extractvalue(xmlcol, '/*/TextBox[@Name=''txtAddress11'']') txtaddress
FROM yourtable

Adapt the XPath to suit your needs.

See ExtractValue documentation or research other Oracle XML functions.


I should probably note that 11g and later, extractvalue is deprecated and you should use XMLQuery

0

精彩评论

暂无评论...
验证码 换一张
取 消