Oracle SQL: How to use more than 1000 items inside an IN statement

Posted by Mehper C. Palavuzlar on Stack Overflow See other posts from Stack Overflow or by Mehper C. Palavuzlar
Published on 2010-03-08T11:57:18Z Indexed on 2010/03/08 12:06 UTC
Read the original article Hit count: 232

Filed under:
|
|
|

I have an SQL statement where I would like to get data of 1200 ep_codes by making use of IN. When I include more than 1000 ep_codes inside IN statement, Oracle says I'm not allowed to do that. To overcome this, I tried to change the SQL code as follows:

SELECT ...
FROM ...
WHERE ...
      AND ep_codes IN (...1000 ep_codes...)
      OR  ep_codes IN (...200 ep_codes...)

The code was executed succesfully but the results are strange. Is it appropriate to do that using OR between INs or should I execute two separate codes as one with 1000 and the other with 200 ep_codes?

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about sql