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.
CASE with ELSE NULL
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
When CASE expressions have no ELSE
clause, the default is ELSE NULL
. There is no need to explicitly set that clause to NULL
.
Using Settings.transformPatternsCaseElseNull, the following transformations can be achieved:
-- With Settings.transformPatternsCaseElseNull active, this: SELECT CASE a WHEN b THEN 1 ELSE NULL END, -- Simple CASE CASE WHEN a = b THEN 1 ELSE NULL END -- Searched CASE FROM tab; -- ... is transformed into the equivalent expression: SELECT CASE a WHEN b THEN 1 END, CASE WHEN a = b THEN 1 END FROM tab;
Feedback
Do you have any feedback about this page? We'd love to hear it!