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

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.

OR to IN

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

A concatenation of OR predicates combining equalities that always use the same operand on one side can be replaced by a more concise, but equivalent IN predicate.

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

-- With Settings.transformPatternsOrEqToIn active, this:
SELECT * FROM tab WHERE x = 1 OR x = 2 OR x = 3;

-- ... is transformed into the equivalent expression:
SELECT * FROM tab WHERE x IN (1, 2, 3);

See also AND to NOT IN


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

The jOOQ Logo