Oralce in 语句中当in(1,2,3...) 条件数量大于1000将会报错。
如果我们把in拆分成多个in就可以解决这个问题。
修改前
select *
from tbl_temp
where
id in
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
select *
from tbl_temp
where
id in (1,2,3)
修改后
select *
from tbl_temp
where
<foreach item="item" index="index" collection="ids" open="(" separator="or" close=")">
id in #{item}
</foreach>
select *
from tbl_temp
where
(id in 1 or id in 2 or id in 3)