select * from log_rate_cloc a
where exists
(select 1
from log_rate_cloc b
where a.raw_file_name = b.raw_file_name
and b.raw_FILE_NAME LIKE '%CLOCC1%0609010015000001%');
select * from log_rate_cloc a
where a.raw_file_name in
(select b.raw_FILE_NAME
from log_rate_cloc b
where b.raw_FILE_NAME LIKE '%CLOCC1%0609010015000001%');
where exists
(select 1
from log_rate_cloc b
where a.raw_file_name = b.raw_file_name
and b.raw_FILE_NAME LIKE '%CLOCC1%0609010015000001%');
select * from log_rate_cloc a
where a.raw_file_name in
(select b.raw_FILE_NAME
from log_rate_cloc b
where b.raw_FILE_NAME LIKE '%CLOCC1%0609010015000001%');
oracle举了两个例子说明什么时候用in, 什么时候用exists ...
两个不一样的。看你是条件的集合比较大还是选取的部分比较大。条件集合小的话用in比较快。反之exists
好比,选取数据部分有100万。条件集合有1000。各么肯定in要快。反之亦然