It's a bit heavy-weight for the use-case as it requires to insert into a table in order to be able to perform a query. It's good to have it as a possible fallback, though.
On Aug 2, 10:44 pm, TerryG <[email protected]> wrote: > If storing the array in a separate table is an option, you could use > the syntax; > > SELECT > * > FROM > T > WHERE > ID IN > (SELECT > ID > FROM > TEMP) > > where TEMP is the name of the table which contains the values for > which you want to search. Would this approach work for you? > Cheers...TerryG > > On Aug 1, 6:06 am, Bernd <[email protected]> wrote: > > > Hi, > > > I need to select all rows from a table with a given column ('ID') > > being in a given set. For the sake of simplicity, let's say the table > > has only the id column; > > > CREATE TABLE T (ID BIGINT); > > > If I knew the number of ids in the set in advance, I could do: > > > "SELECT * FROM T WHERE ID in (?, ?, ?); > > > where '?' is the placeholder int the PreparedStatement. > > > Unfortunately I do not know the size of the set of ids at compile time > > but only at run time. According to SQL92 I can do: > > > "SELECT * FROM T WHERE ID = ANY (?); > > > and provide a SQL ARRAY of BIGINTs as PreparedStatement parameter. > > This works flawlessly with PostgreSQL. However, H2 doesn't seem to > > support the '=ANY' operator. > > > Note that I have to use a PreparedStatement as my framework, which is > > EoDSQL, requires it. Thus the obvious solution of not using a > > PreparedStatement but instead building the string of the id set '(x, > > y, z, ...)' in Java is ruled out. > > > What are the options to do this in H2? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/h2-database?hl=en -~----------~----~----~----~------~----~------~--~---
