title: SQL to JOOQ translation: type error
body: <p>I'm trying to translate the following SQL statement into JOOQ:</p>
  
  <pre><code>UPDATE training_content
  SET indx = (
      SELECT SUM(indx)
      FROM training_content
      WHERE indx = ? OR indx = ?
  ) - indx
  WHERE indx = ? OR indx = ?;
  </code></pre>
  
  <p>The sqlite database looks like this:</p>
  
  <pre><code>CREATE TABLE training_content (
    training_id INTEGER NOT NULL,
    set_id INTEGER NOT NULL,
    indx INTEGER NOT NULL,
    FOREIGN KEY(training_id) REFERENCES training(training_id) ON DELETE CASCADE ON UPDATE CASCADE,
    FOREIGN KEY(set_id) REFERENCES sets(set_id) ON DELETE CASCADE ON UPDATE CASCADE
  );
  </code></pre>
  
  <p>The sql statement swaps two indexes and is used to arrange set objects in a list and is called like this:</p>
  
  <pre><code>public void updateIndex(Training t, int index, boolean up) throws SQLException {
      updateIndexStmt.setInt(1, index);
      updateIndexStmt.setInt(2, index + (up ? -1 : 1));
      updateIndexStmt.setInt(3, index);
      updateIndexStmt.setInt(4, index + (up ? -1 : 1));
      updateIndexStmt.executeUpdate();
  }
  </code></pre>
  
  <p>Since i'm moving from plain JDBC to JOOQ i tried to translate it into this:</p>
  
  <pre><code>public void updateIndex(Training t, int index, boolean up) throws SQLException {
      create.update(TRAINING_CONTENT)
              .set(TRAINING_CONTENT.INDX,
                      DSL.select(DSL.sum(TRAINING_CONTENT.INDX).minus(TRAINING_CONTENT.INDX))
                              .from(TRAINING_CONTENT)
                              .where(TRAINING_CONTENT.INDX.equal(index)
                                      .or(TRAINING_CONTENT.INDX.equal(index + (up ? -1 : +1))))
              );
  }
  </code></pre>
  
  <p>But I get the weirdest and longest error message I have ever gotten in Java:</p>
  
  <pre><code>Error:(50, 17) java: no suitable method found for set(org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt;,org.jooq.SelectConditionStep&lt;org.jooq.Record1&lt;java.math.BigDecimal&gt;&gt;)
  method org.jooq.UpdateSetStep.&lt;T&gt;set(org.jooq.Field&lt;T&gt;,T) is not applicable
    (inference variable T has incompatible bounds
      equality constraints: java.lang.Integer
      lower bounds: org.jooq.SelectConditionStep&lt;org.jooq.Record1&lt;java.math.BigDecimal&gt;&gt;)
  method org.jooq.UpdateSetStep.&lt;T&gt;set(org.jooq.Field&lt;T&gt;,org.jooq.Field&lt;T&gt;) is not applicable
    (cannot infer type-variable(s) T
      (argument mismatch; org.jooq.SelectConditionStep&lt;org.jooq.Record1&lt;java.math.BigDecimal&gt;&gt; cannot be converted to org.jooq.Field&lt;T&gt;))
  method org.jooq.UpdateSetStep.&lt;T&gt;set(org.jooq.Field&lt;T&gt;,org.jooq.Select&lt;? extends org.jooq.Record1&lt;T&gt;&gt;) is not applicable
    (inferred type does not conform to equality constraint(s)
      inferred: java.math.BigDecimal
      equality constraints(s): java.math.BigDecimal,java.lang.Integer)
  method org.jooq.UpdateSetFirstStep.&lt;T1&gt;set(org.jooq.Row1&lt;T1&gt;,org.jooq.Row1&lt;T1&gt;) is not applicable
    (cannot infer type-variable(s) T1
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row1&lt;T1&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2&gt;set(org.jooq.Row2&lt;T1,T2&gt;,org.jooq.Row2&lt;T1,T2&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row2&lt;T1,T2&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3&gt;set(org.jooq.Row3&lt;T1,T2,T3&gt;,org.jooq.Row3&lt;T1,T2,T3&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row3&lt;T1,T2,T3&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4&gt;set(org.jooq.Row4&lt;T1,T2,T3,T4&gt;,org.jooq.Row4&lt;T1,T2,T3,T4&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row4&lt;T1,T2,T3,T4&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5&gt;set(org.jooq.Row5&lt;T1,T2,T3,T4,T5&gt;,org.jooq.Row5&lt;T1,T2,T3,T4,T5&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row5&lt;T1,T2,T3,T4,T5&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6&gt;set(org.jooq.Row6&lt;T1,T2,T3,T4,T5,T6&gt;,org.jooq.Row6&lt;T1,T2,T3,T4,T5,T6&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row6&lt;T1,T2,T3,T4,T5,T6&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7&gt;set(org.jooq.Row7&lt;T1,T2,T3,T4,T5,T6,T7&gt;,org.jooq.Row7&lt;T1,T2,T3,T4,T5,T6,T7&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row7&lt;T1,T2,T3,T4,T5,T6,T7&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8&gt;set(org.jooq.Row8&lt;T1,T2,T3,T4,T5,T6,T7,T8&gt;,org.jooq.Row8&lt;T1,T2,T3,T4,T5,T6,T7,T8&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row8&lt;T1,T2,T3,T4,T5,T6,T7,T8&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9&gt;set(org.jooq.Row9&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9&gt;,org.jooq.Row9&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row9&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10&gt;set(org.jooq.Row10&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10&gt;,org.jooq.Row10&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row10&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11&gt;set(org.jooq.Row11&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11&gt;,org.jooq.Row11&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row11&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12&gt;set(org.jooq.Row12&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12&gt;,org.jooq.Row12&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row12&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13&gt;set(org.jooq.Row13&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13&gt;,org.jooq.Row13&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row13&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14&gt;set(org.jooq.Row14&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14&gt;,org.jooq.Row14&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row14&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15&gt;set(org.jooq.Row15&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15&gt;,org.jooq.Row15&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row15&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16&gt;set(org.jooq.Row16&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16&gt;,org.jooq.Row16&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row16&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17&gt;set(org.jooq.Row17&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17&gt;,org.jooq.Row17&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row17&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18&gt;set(org.jooq.Row18&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18&gt;,org.jooq.Row18&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row18&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19&gt;set(org.jooq.Row19&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19&gt;,org.jooq.Row19&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row19&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20&gt;set(org.jooq.Row20&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20&gt;,org.jooq.Row20&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row20&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21&gt;set(org.jooq.Row21&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21&gt;,org.jooq.Row21&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row21&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22&gt;set(org.jooq.Row22&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22&gt;,org.jooq.Row22&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row22&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1&gt;set(org.jooq.Row1&lt;T1&gt;,org.jooq.Select&lt;? extends org.jooq.Record1&lt;T1&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row1&lt;T1&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2&gt;set(org.jooq.Row2&lt;T1,T2&gt;,org.jooq.Select&lt;? extends org.jooq.Record2&lt;T1,T2&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row2&lt;T1,T2&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3&gt;set(org.jooq.Row3&lt;T1,T2,T3&gt;,org.jooq.Select&lt;? extends org.jooq.Record3&lt;T1,T2,T3&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row3&lt;T1,T2,T3&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4&gt;set(org.jooq.Row4&lt;T1,T2,T3,T4&gt;,org.jooq.Select&lt;? extends org.jooq.Record4&lt;T1,T2,T3,T4&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row4&lt;T1,T2,T3,T4&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5&gt;set(org.jooq.Row5&lt;T1,T2,T3,T4,T5&gt;,org.jooq.Select&lt;? extends org.jooq.Record5&lt;T1,T2,T3,T4,T5&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row5&lt;T1,T2,T3,T4,T5&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6&gt;set(org.jooq.Row6&lt;T1,T2,T3,T4,T5,T6&gt;,org.jooq.Select&lt;? extends org.jooq.Record6&lt;T1,T2,T3,T4,T5,T6&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row6&lt;T1,T2,T3,T4,T5,T6&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7&gt;set(org.jooq.Row7&lt;T1,T2,T3,T4,T5,T6,T7&gt;,org.jooq.Select&lt;? extends org.jooq.Record7&lt;T1,T2,T3,T4,T5,T6,T7&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row7&lt;T1,T2,T3,T4,T5,T6,T7&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8&gt;set(org.jooq.Row8&lt;T1,T2,T3,T4,T5,T6,T7,T8&gt;,org.jooq.Select&lt;? extends org.jooq.Record8&lt;T1,T2,T3,T4,T5,T6,T7,T8&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row8&lt;T1,T2,T3,T4,T5,T6,T7,T8&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9&gt;set(org.jooq.Row9&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9&gt;,org.jooq.Select&lt;? extends org.jooq.Record9&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row9&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10&gt;set(org.jooq.Row10&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10&gt;,org.jooq.Select&lt;? extends org.jooq.Record10&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row10&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11&gt;set(org.jooq.Row11&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11&gt;,org.jooq.Select&lt;? extends org.jooq.Record11&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row11&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12&gt;set(org.jooq.Row12&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12&gt;,org.jooq.Select&lt;? extends org.jooq.Record12&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row12&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13&gt;set(org.jooq.Row13&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13&gt;,org.jooq.Select&lt;? extends org.jooq.Record13&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row13&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14&gt;set(org.jooq.Row14&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14&gt;,org.jooq.Select&lt;? extends org.jooq.Record14&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row14&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15&gt;set(org.jooq.Row15&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15&gt;,org.jooq.Select&lt;? extends org.jooq.Record15&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row15&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16&gt;set(org.jooq.Row16&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16&gt;,org.jooq.Select&lt;? extends org.jooq.Record16&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row16&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17&gt;set(org.jooq.Row17&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17&gt;,org.jooq.Select&lt;? extends org.jooq.Record17&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row17&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18&gt;set(org.jooq.Row18&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18&gt;,org.jooq.Select&lt;? extends org.jooq.Record18&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row18&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19&gt;set(org.jooq.Row19&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19&gt;,org.jooq.Select&lt;? extends org.jooq.Record19&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row19&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20&gt;set(org.jooq.Row20&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20&gt;,org.jooq.Select&lt;? extends org.jooq.Record20&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row20&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21&gt;set(org.jooq.Row21&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21&gt;,org.jooq.Select&lt;? extends org.jooq.Record21&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row21&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21&gt;))
  method org.jooq.UpdateSetFirstStep.&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22&gt;set(org.jooq.Row22&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22&gt;,org.jooq.Select&lt;? extends org.jooq.Record22&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22&gt;&gt;) is not applicable
    (cannot infer type-variable(s) T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22
      (argument mismatch; org.jooq.TableField&lt;ch.tiim.sco.database.jooq.tables.records.TrainingContentRecord,java.lang.Integer&gt; cannot be converted to org.jooq.Row22&lt;T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22&gt;))
  </code></pre>
  
  <h2>EDIT</h2>
  
  <p>This JOOQ code does almost work:</p>
  
  <pre><code>update(TRAINING_CONTENT)
              .set(TRAINING_CONTENT.INDX,
                      select(sum(t.INDX).minus(TRAINING_CONTENT.INDX).coerce(Integer.class))
                              .from(t)
                              .where(t.INDX.equal(index)
                                      .or(t.INDX.equal(index + (up ? -1 : +1))))
              ).where(TRAINING_CONTENT.INDX.equal(index)
                      .or(TRAINING_CONTENT.INDX.equal(index + (up ? -1 : +1))))
  </code></pre>
  
  <p>But it generates the following SQL:</p>
  
  <pre><code>update training_content 
  set indx = (
    select (sum(t.indx) - training_content.indx)
    from training_content t 
    where (t.indx = 2 or t.indx = 1)
  ) 
  where (training_content.indx = 2 or training_content.indx = 1);
  </code></pre>
  
  <p>But the part <code>select (sum(t.indx) - training_content.indx)</code> does not work like it should with my original SQL code: it selects for both columns the same value instead of switching them.</p>