jQuery in Action, 2nd edition*
The moose likes JDBC and the fly likes SELECT * FROM TESTTABLE WHERE ID IN (?) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SELECT * FROM TESTTABLE WHERE ID IN (?)" Watch "SELECT * FROM TESTTABLE WHERE ID IN (?)" New topic
Author

SELECT * FROM TESTTABLE WHERE ID IN (?)

Geoffrey Graff
Greenhorn

Joined: Sep 20, 2001
Posts: 5
Hi,
I have a query (SELECT * FROM TESTTABLE WHERE ID IN (?)) and I want to pass in parameter a list of values (an array or something like that) to put in my condition IN.
How can I do in java ? Is there something special in the PreparedStatement ? Or have I to use another statement or another type of query ?
Thanks
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
You can have an array object hold your variables. You can then use the prepared statement's setObject method to set it to the name of the array.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170


[ June 11, 2002: Message edited by: CL Gilbert ]
 
wood burning stoves
 
subject: SELECT * FROM TESTTABLE WHERE ID IN (?)