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

Flatten DECODE

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

The DECODE function can be nested. In some cases, however, that nesting is unnecessary. Hence, we flatten the function calls.

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

-- With Settings.transformPatternsFlattenDecode active, this:
SELECT
  DECODE(a, b, c, DECODE(a, d, e)),
  DECODE(a, b, c, DECODE(a, d, e, f))
FROM tab;

-- ... is transformed into the equivalent expression:
SELECT
  DECODE(a, b, c, d, e),
  DECODE(a, b, c, d, e, f)
FROM tab;

Feedback

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

The jOOQ Logo