Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>jOOQ works as expected, here. The <a href="http://www.jooq.org/javadoc/latest/org/jooq/Field.html#in-org.jooq.Field...-" rel="nofollow"><code>Field.in(...)</code></a> method accepts several values for the IN predicate through a varargs parameter. Hence, if you want to express a predicate with several values, you will have to provide the method with several values.</p> <p>Your utility method should thus read:</p> <pre class="lang-java prettyprint-override"><code>// I'm assuming this static import import static org.jooq.impl.DSL.*; private String generateSQLWithWhereInInline(String... businessGroupProcesses) { Field&lt;String&gt;[] fields = new Field[businessGroupProcesses.length]; for (int i = 0; i &lt; businessGroupProcesses.length; i++) fields[i] = inline(businessGroupProcesses[i]); return DSL.using(SQLDialect.ORACLE) .selectDistinct( field(name("Business Group")).as("Business_Group")) .from(table(name("SOME_TABLE"))) .where(field(name("Business Group Process")).in(fields)) .getSQL(); } </code></pre> <p>An easier method might be to provide the DSLContext with a setting to tell it to inline all bind values directly. This is documented here:</p> <p><a href="http://www.jooq.org/doc/latest/manual/sql-building/dsl-context/custom-settings" rel="nofollow">http://www.jooq.org/doc/latest/manual/sql-building/dsl-context/custom-settings</a></p> <p>Your method would then read:</p> <pre class="lang-java prettyprint-override"><code>private String generateSQLWithWhereInInline(String... businessGroupProcesses) { Settings settings = new Settings() .withStatementType(StatementType.STATIC_STATEMENT); return DSL.using(SQLDialect.ORACLE, settings); .selectDistinct( field(name("Business Group")).as("Business_Group")) .from(table(name("SOME_TABLE"))) .where(field(name("Business Group Process")) .in(businessGroupProcesses)) .getSQL(); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload