【发布时间】:2017-02-17 22:06:04
【问题描述】:
<List>
<Event>
<eventTime>2016-08-03T15:41:12.000+05:30</eventTime>
<e:PlaceHolder xmlns:e="http://dpmt.element.com">US</e:PlaceHolder>
<e:flag xmlns:e="http://dpmt.rmg.org/pq/rs">true</e:flag>
<e:flag1 xmlns:e="http://dpmt.rmg.org/pq/rs">false</e:flag1>
</Event>
<Event>
<eventTime>2016-08-01T19:41:12.000+05:30</eventTime>
</Event>
</List>
我以这种方式存储了我的 XML 文档,其中可能包含多个 <Event> 标记,使用 X-Path 查询,我只想获取该事件,其 e:flag 值为 true,在我的情况下,我必须使用 where 子句仅获取第一个事件标签。我需要在 where 子句中按条件使用 EXTRACT 或 ExtractValue 函数的通用查询来检查其标志值。
我是这样写查询的:-
选择 * FROM (SELECT EXTRACT(doc,'//List').getClobVal() AS doc FROM my_table) T;
【问题讨论】:
标签: sql xml oracle xpath xml-parsing