jdbc preparedStatement "IN" ?
Posted on 2003-11-21
I have a statement I'd like to prepare that includes an IN clause. Say... I want to find all orders IN (?), where ? is an unknown number of order ids. Is this possible with PreparedStatements, or do I need to handbuild it? ? could range from 1 to several hundred numbers. I'm currently concatenating a String, which rather defeats one of the purposes of having a PreparedStatement. I tried setting the value with setArray and setString, neither of which did much good (I didn't expect setString to work, but... worth a try, eh?)
I'm using postgresql 7.2 at home and mysql 4.0.13 at work, so would appreciate answers for either if there's a difference... (driver dependant?)