【发布时间】:2013-05-20 15:05:02
【问题描述】:
我正在使用旧应用程序上的 Oracle 数据库,但无法为其提出特定查询。
基本上我有一个 T_Selected 表,其中包含一个数字列(主键)和一个 xmltype 列。 XML 的格式为
<countries>
<country>England</country>
<country>Ireland</country>
<country>Scotland</country>
<country>Wales</country>
</countries>
我还有另一个表需要查询并使用结果
select country from T_Countries where language = 'English'
我需要三个查询及其否定。
xml ∈ 子查询中的所有国家
子查询 ∈ xml 中的所有国家
xml中的所有国家=所有子查询
我得到的最接近的是
select id from
T_Selected ts,
XMLTABLE('/countries/country'
passing ts.Values
columns
Country path '//country'
) XML
where XML.country in (select country from T_Countries
where language ='English');
这将返回任何 xml 国家/地区在子查询中的 ID,而不是所有国家/地区。
有什么想法可以解决这个问题吗?
感谢您的帮助,
尼尔
【问题讨论】:
标签: sql oracle xmltype set-theory