0

我想在 CLOB 中搜索一个字符串:

就像是id_name_2569

我得到了我需要的所有 ID,如下所示:

select project_line_id as ID
from tbl1
where art_id in (
                  select art_id
                  from tbl2
                  where type = 3
                 );

我在这个表中搜索:A1 是一个 CLOB 字段

select * from tbl3 where dbms_lob.instr(A1, ID)>0;

显然它不起作用我知道,这是我可以做到这一点的方法吗?

4

2 回答 2

1

像这样的东西应该工作:

select tbl3.*
  from tbl1
       inner join tbl2
               on tbl2.art_id = tbl1.art_id
       inner join tbl3
               on tbl3.a1 like '%' || tbl1.project_line_id || '%'
 where tbl2.type = 3;
于 2013-02-26T14:47:32.090 回答
1

您可以DBMS_LOB.instr直接用作连接条件:

SELECT *
  FROM (SELECT project_line_id AS ID 
          FROM tbl1 
         WHERE art_id IN (SELECT art_id FROM tbl2 WHERE TYPE = 3)) v
  JOIN tbl3 ON dbms_lob.instr(tbl3.a1, v.ID) > 0
于 2013-02-26T15:11:14.410 回答