Alternatives to IN in Oracle

I have a table that has 7 million unique ID's.
I'm looking for 24k that are coming off a spreadsheet.

I have read only access to the tables, so I don't think I can create
a temp table to join off of for filtering.

What would be the best way to return the ID's I want, and their
corresponding fields, given that IN only allows 1,000 arguments (I think)?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

select * from yourtable where yourid in (1,2,3,....1000)
or yourid in (1001,1002,...., 2000)
or yourid in (2001, ...., 3000)


change the inlists to be your actual values.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JustinWAuthor Commented:
Is this the fastest way?
Is there not like a CTE thing you can do in oracle, like in SQLServer?
sure you could but it's unlikely to be faster
probably not slower either  I'd expect them to be about the same

if you like cte better, try this...

with cte as (select 1 n from dual union all select 2 from dual union all select 3 from dual
union all .....
select 24000 from dual)
select * from yourtable where yourid in (select n from cte)
JustinWAuthor Commented:
thanks for doing both!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.