1.使用union all
select * from table1 where ID in (1,2,3,4,...,1000)
union all
select * from table1 where ID in (1001,1002,...)
2.使用or
select * from table1 where ID in (1,2,3,4,...,1000) or
ID in (1001,1002,...,2000)
3.使用兩個欄位in
select ... where ('bla', colX ) in (
('bla', 1),
('bla', 2),
('bla', 3),
('bla', 4),
...
('bla', 9999)
) ...
4.開table
select ...
where id in (select userId
from temptable_with_2000_ids )
Ref:http://stackoverflow.com/questions/400255/how-to-put-more-than-1000-values-into-an-oracle-in-clause