0

I am writing the java program in which I need to compare the large number of List<String> ids to see are these ids are exist in the database ? I know it can be done with big select query select id from my_table where id in ('1','2''3''4''5'...) which leads very big sql query.

is there any other way of doing this in Oracle 11g ?

Thanks

1
  • Use BETWEEN if you have distinct ids. Commented Mar 6, 2014 at 7:30

1 Answer 1

0

First of all you should be aware of Oracles IN clause limit (SQL IN Clause 1000 item limit). So you could avoid this if you split your large in into smaller ones like

select id from my_table where id in ('1','2','3') or id in ('4','5'...) 

or run multiple requests in Oracle

select id from my_table where id in ('1','2','3'); select id from my_table where id in ('4','5'...); 

or there are other possibilites (see linked question).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.