Convert DECODE to CASE
ProprietaryReplaces Oracle's DECODE(expr, search, result, ..., default) with the equivalent CASE expression. DECODE treats two NULLs as equal, which CASE expr WHEN does not. So when a search value is NULL, '', or not a literal, the DECODE becomes a searched CASE that tests it with IS NULL or IS NOT DISTINCT FROM. A searched CASE repeats the expression in every test, so one holding a ? parameter, a subquery or a sequence value is left as a DECODE.
org. openrewrite. sql. ConvertDecodeToCasemod run . --recipe= org. openrewrite. sql. ConvertDecodeToCaseInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.