Oracle Text查询数百个关键字

时间:2014-09-18 15:00:14

标签: sql contains oracle-text

Oracle Text很棒。但现在我必须查询存储在单独表格中的超过100个单词(让我们说table_keywords)。如果不将所有关键字都写入查询,有人知道怎么做吗?

而不是

Select a_id, text from xy where 
contains(text, 'x')>0 or
contains(text, 'x1')>0 or 
contains(text, 'x2')>0 or 
etc.

不要

Select a_id, text from xy where contains(text, table_keywords)>0
是的......那可能吗?

非常感谢!

2 个答案:

答案 0 :(得分:0)

我首先尝试使用join或类似的东西。这有用吗?

select a_id, text
from xy
where exists (select 1
              from keywords kw
              where contains(xy.text, kw.word) > 0
             );

答案 1 :(得分:0)

加入的提示是黄金!

解决方案

Select a_id, text from xy
    inner join keywords kw on contains(xy.text, kw.word)>0