| Author |
How to pass values to a Oracle query with a IN clause
|
Akshay Sharma
Ranch Hand
Joined: Mar 27, 2003
Posts: 42
|
|
SELECT * FROM test WHERE a IN ('0515','0514','0516') In java SELECT * FROM test WHERE a IN (?) String temp = "'0515','0514','0516'"; pstmt.setString (1,temp); This does not work.
|
Akshay Kumar Sharma<br />**********************<br />Good Better Best <br />Never Let it rest<br />For your good is better<br />and the better is the best
|
 |
Raj Chila
Ranch Hand
Joined: Mar 18, 2004
Posts: 125
|
|
Hi, May be the String that you are setting to the prepared statement would be treated as one String arguement..so the final Query would look like SELECT * FROM test WHERE a IN (' '0515','0514','0516' '); // Note the Quotes I dont know if this should actually result in an SQLException. try using SELECT * FROM test WHERE a IN (?,?,?); and then set the each Parameter...this might help. [ December 23, 2004: Message edited by: RajaniKanth Bhargava ]
|
 |
 |
|
|
subject: How to pass values to a Oracle query with a IN clause
|
|
|