Jim Newsham <[EMAIL PROTECTED]> writes: >> From: Army [mailto:[EMAIL PROTECTED] [...] >> So maybe try something like: >> >> select a, b, c >> from x, (values ('a', 'b', 'c')) as y (y1,y2,y3) >> where x.a = y.y1 > > This works fine for me unless the values in the VALUES clause are all > parameterized (i.e., with "?" placeholders in prepared statements). I can > work around this problem by interpolating the values directly into the > string, but I'll lose the benefit of Derby's prepared statement cache, which > will really slow down all my queries. > > Here is the error message I get: > > Caused by: ERROR 42Y10: A table constructor that is not in an INSERT > statement has all ? parameters in one of its columns. For each column, at > least one of the rows must have a non-parameter. > > Here is an offending query: > > select distinct sample.time, sample.value from int_sample as sample, (values > ((?), (?))) as subquery(time) where sample.fk_band_id = ? and sample.time = > subquery.time order by sample.time asc
Does it work if you replace the first ? with CAST(? AS VARCHAR(128))? -- Knut Anders