ORA-01795: 列表中的最大表达式数为1000 解决方法

来源:互联网 发布:pccillin云安全软件 编辑:程序博客网 时间:2024/05/22 10:52

在写 select * from table where id in( id1, id2, id3...) 的sql语句时,若参数数据量大的话,超过1000就报ORA-01795: 列表中的最大表达式数为1000。

oracle 有这个限制,但是我们可以想一些别的办法来避免这个问题的出现,比如借助临时表:


select * from table where id in (with t as (select 402800 as container_id from dual union all select 402801 as container_id from dual...) select container_id from t);


我亲测了一下,需要时间可能长点,毕竟是多条查询语句,但是如果性能要求不是很高的话,可以采纳。

0 0