Available in versions: Dev (3.19) | Latest (3.18) | 3.17

This is experimental functionality, and as such subject to change. Use at your own risk!

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

Merge NOT with comparison predicates

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The NOT predicate inverts its argument predicate. If the argument predicate is a comparison predicate, we can simply merge the two operators to invert the argument into the inverse comparison predicate.

Using Settings.transformPatternsNotComparison, the following transformations can be achieved:

-- With Settings.transformPatternsNotComparison active, this:
  NOT (a = b),
  NOT (a != b),
  NOT (a > b),
  NOT (a >= b),
  NOT (a < b),
  NOT (a <= b)
FROM tab;

-- ... is transformed into the equivalent expression:
  a != b, -- NOT (a = b)
  a = b,  -- NOT (a != b)
  a <= b, -- NOT (a > b)
  a < b,  -- NOT (a >= b)
  a >= b, -- NOT (a < b)
  a > b   -- NOT (a <= b)
FROM tab;


Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo