我想在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;
显然它不起作用,我知道,这是我能做到这一点的方式吗?
答案 0 :(得分: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;
答案 1 :(得分: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