如何检索指定值的xml数据

时间:2012-07-02 06:16:06

标签: oracle10g

您好我是Oracle 10g的新手。我需要从'fl1'中检索所有子列表。我知道要检索tagwise ..如何使用指定的值检索tagwise?

 <lists> <Firstlist name = 'fl1'>
     <sublist>s1</sublist>
     <sublist>s2</sublist>
     <sublist>s3</sublist> 
 </firstlist>
 <Firstlist name = 'fl2'>
     <sublist>sb1</sublist>
     <sublist>sb2</sublist>
     <sublist>sb3</sublist> 
 </firstlist> </lists>

1 个答案:

答案 0 :(得分:0)

实际上这更像是一个XPATH问题:

//Firstlist [@name = "fl1"]/sublist

所以查询可能是这样的:

SELECT xmlelement("r",xmltype(xmlstr)).extract('//Firstlist [@name = "fl1"]/sublist').getstringval() FROM your_table

Here是一个小提琴