• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Gaurav Goyal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2608
14
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JavAranch article Batching Select Statements in JDBC by Jeanne Boyarsky proposes some approaches to handle this.

Regards, Jan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic