Oracle中,in語句中可放的最大參數個數是1000個。之前遇到超過1000的情況,可用如下語句,但如此多參數項目會低,可考慮用別的方式優化。
select * from Table where id in(xxx,xxx...) or id in(yyy,yyy,...)
mysql中,in語句中參數個數是不限制的。不過對整段sql語句的長度有了限制(max_allowed_packet
)。
References:
https://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html#function_in
https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_max_allowed_packet