oracle-databasein-clause

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


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,...)

Solution

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