I sorted it out by using static statements and not using the bind parameters Settings settings = new Settings() .withStatementType(StatementType.STATIC_STATEMENT); Factory factory = new OracleFactory(conn, settings);
Thanks Pelle On Friday, November 2, 2012 2:21:54 PM UTC+1, Lukas Eder wrote: > > Hello Pelle, > > I am not able to reproduce this right now. Can you provide me with a > minimal example for reproduction? Something along these lines: > > Table<?> table = ... > String columnName = ... > Set<String> values = ... > Factory f = new Factory(dialect); > String sql = f.selectFrom(table).where(Factory.fieldByName(String.class, > columnName).in(values)).getSQL(); > > Note, that your variable binding is wrong. If you have two values in your > set, jOOQ will generate two bind variables: "... IN (?, ?)". In that case, > you'll have to iterate over your set, and bind every value one-by-one. > > Cheers > Lukas > > 2012/11/2 <[email protected] <javascript:>> > >> Hi, >> I am trying to use a collection of strings in an in clause. The >> collection contains the following values "STCTEST" and "ABCD". I want the >> generated sql to look like IN ('STCTEST', 'ABCD*) but JOOQ generates IN >> ('[STCTEST, ABCD]'). Not sure what I am missing; >> The code used is as follows: >> >> private void addToSql(SimpleSelectConditionStep<Record> sql, >> String columnName, Set<String> values, AtomicInteger index) { >> if (values != null && values.size() > 0) { >> sql.and(Factory.fieldByName(String.class, columnName).in(values)); >> sql.bind(index.getAndIncrement(), values); >> } >> } >> >> /Pelle >> > >
