rules repository

G-4240 – Always use a CASE instead of a NVL2 command if parameter 2 or 3 of NVL2 is either a function call or a SELECT statement.

The `nvl2` function always evaluates all parameters before deciding which one to use. This can be harmful, if parameter 2 or 3 is either a function call or a select statement, as they will be executed regardless of whether parameter 1 contains a `null` value or not.

Tags: Performance, Control.

Quality area: Reliability. Severity: Critical. Fixing time: Local-medium.

No rule selected