【Mybatis】【5】Oralce in 語句中當in(1,2,3...) 條件數量大於1000將會報錯


未超過1000時的寫法:

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)

超過1000時的寫法:

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)

參考博客:

mybatis關於oracle in 1000個數限制的解決 - Paul Joo的專欄 - CSDN博客
https://blog.csdn.net/zsdjoo/article/details/42290591?utm_source=blogxgwz4


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM