0

嗨,我是 Oracle 10g 的新手。我需要从“fl1”中检索所有子列表。我知道要按标签检索。如何按指定的值按标签检索?

 <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>
4

1 回答 1

0

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

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

所以查询可能是这样的:

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

是一个小提琴

于 2012-07-02T07:15:45.427 回答