aspose file tools*
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 Java 8 in Action this week in the Java 8 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: 1506
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SELECT * FROM TESTTABLE WHERE ID IN (?)
 
Similar Threads
delete duplicate rows
Hibernate Query problem.
Cannot update Clob to Oracle by using JDBC
Executing one resultset inside another
How can we view the generated sql using PreparedStatement ?