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.

Trivial CASE abbreviations

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

Case abbreviations like NULLIF() can be trivial, in case of which the function call can be removed.

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

-- With Settings.transformPatternsTrivialCaseAbbreviation active, this:
SELECT
  NVL(NULL, a),
  NVL(1, a),
  COALESCE(NULL, NULL, a),
  COALESCE(1, a, b),
  NULLIF(a, a),
  NULLIF(NULL, a),
  NULLIF(a, NULL)
FROM tab;

-- ... is transformed into the equivalent expression:
SELECT
  a,    -- NVL(NULL, a),
  1,    -- NVL(1, a),
  a,    -- COALESCE(NULL, NULL, a),
  1,    -- COALESCE(1, a, b),
  NULL, -- NULLIF(a, a),
  NULL, -- NULLIF(NULL, a),
  a     -- NULLIF(a, NULL)
FROM tab;

Feedback

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

The jOOQ Logo