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!

Setting multiple values for one paramater index (prepared statements)

843859Apr 8 2008 — edited Jan 14 2015
Say I have a properties file with a SQL statement such as:

SELECT * FROM myTable,
WHERE name like '?'

At different times, I will want to select a different number of names.

SELECT * FROM myTable,
WHERE name like 'Bob'

SELECT * FROM myTable
WHERE name like 'Bob'
AND name like 'Jane'
AND name like 'Joe'
AND name like 'Fred'

Is there a way to do this using prepared statements in java? I will only have a 1 parameter index, but want to set multiple values to search for.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2008
Added on Apr 8 2008
4 comments
117 views