G-4220: Try to use CASE rather than DECODE.
Minor
Maintainability, Portability
Reason
DECODE
is an ORACLE specific function hard to understand and restricted to SQL only. The “newer” CASE
function is much more common has a better readability and may be used within PL/SQL too.
Example (bad)
SELECT DECODE(dummy, 'X', 1
, 'Y', 2
, 'Z', 3
, 0)
FROM dual;
Example (good)
SELECT CASE dummy
WHEN 'X' THEN 1
WHEN 'Y' THEN 2
WHEN 'Z' THEN 3
ELSE 0
END
FROM dual;