How to put more than 1000 values into an Oracle IN clause

Aaron Palmer picture Aaron Palmer · Dec 30, 2008 · Viewed 305.9k times · Source

Is there any way to get around the Oracle 10g limitation of 1000 items in a static IN clause? I have a comma delimited list of many of IDs that I want to use in an IN clause, Sometimes this list can exceed 1000 items, at which point Oracle throws an error. The query is similar to this...

select * from table1 where ID in (1,2,3,4,...,1001,1002,...)

Answer

Otávio Décio picture Otávio Décio · Dec 30, 2008

Put the values in a temporary table and then do a select where id in (select id from temptable)