Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Elegant alternative for constructing IN clause for SELECT?

843854Dec 10 2003 — edited Mar 22 2006
I want to run a query like this:
SELECT place_id FROM ias.place WHERE uid_plc = ?
but for multiple values, like this:
SELECT place_id FROM ias.place WHERE uid_plc IN ('one', 'two', 'three')

The number of possible values for the IN clause is dynamic. Running the same PreparedStatement multiple times is very inefficient and constructing an IN clause seems inelegant. setBatch() and executeBatch() don't appear to work for a SELECT statement. Anyone have any other alternatives?

Thanks.

Eric
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 19 2006
Added on Dec 10 2003
28 comments
806 views