Re: JDBC and WHERE IN clauses

2005-09-25 Thread Tony Seebregts
Hi Satheesh/Mike/Rick, Thanks for the suggestions... was hoping there was a neater way that would be usable with the DAO tool we're using but I guess we'll go with generating the SQL statement on the fly. The temporary table idea is neat and would work ... but the overhead is probably not just

Re: JDBC and WHERE IN clauses

2005-09-23 Thread Rick Hillegas
Hi Tony, You could try using a temporary table to hold your parameter values. By changing the contents of the temporary table you might achieve what you want. Something like the following: declare global temporary table session.ztemp ( param int ) not logged; select * from names where id in

Re: JDBC and WHERE IN clauses

2005-09-23 Thread Michael Vinca
Well, when you build the prepared statement, you could just loop and add "?, " to the string for the length of the array. Of course, at this point, you could just do a normal statement. But if you are programmatically filling in the prepared statement anyway, this could be a solution. Depends o

Re: JDBC and WHERE IN clauses

2005-09-23 Thread Satheesh Bandaram
Don't think you can do this in Derby. However, you can do: SELECT * FROM Names WHERE ID IN (?, ?, ?) and bind individual elements of the array to each of the parameters. This, of course, forces you to know the number of elements of the array.. Satheesh Tony Seebregts wrote: > Hi, > > Does anyb

JDBC and WHERE IN clauses

2005-09-23 Thread Tony Seebregts
Hi, Does anybody know of a way to use a PreparedStatement with a WHERE IN (?) clause e.g. SELECT * FROM Names WHERE ID IN (?) where the parameter is replaced by an array of e.g. int's ? regards Tony Seebregts