aspose file tools
The moose likes JDBC and the fly likes How to set multiple values in PrepareStatement while using Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "How to set multiple values in PrepareStatement while using "IN" in the query" Watch "How to set multiple values in PrepareStatement while using "IN" in the query" New topic
Author

How to set multiple values in PrepareStatement while using "IN" in the query

Gaurav Goyal
Greenhorn

Joined: Apr 25, 2006
Posts: 6
For the foll prepared stmt

ps=Connection.prepareStatement(select * from EMPLOYEE
where emp_name IN ? );

Suppose i have 3 names to find "black", "brown" and "green"

what shd I pass to setString method

ps.setString(1,_______);
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2343

The JavAranch article Batching Select Statements in JDBC by Jeanne Boyarsky proposes some approaches to handle this.

Regards, Jan


OCUP UML fundamental
ITIL foundation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set multiple values in PrepareStatement while using "IN" in the query
 
Similar Threads
Cant use object from another class
Posting to bump up my count...
WA #1.....word association
The x900 effect ?
Text box value is not being completely filled with request attribute