G-4220: Try to use CASE rather than DECODE.
Minor
Maintainability, Portability
Reason
DECODE
is an ORACLE specific function that can be hard to understand (particularly when not formatted well) and is restricted to SQL only. The CASE
function is much more common has a better readability and may be used within PL/SQL too.
Example (bad)
1 2 3 4 5 | select decode(dummy, 'x', 1 , 'y', 2 , 'z', 3 , 0) from dual; |
Example (good)
1 2 3 4 5 6 7 | select case dummy when 'x' then 1 when 'y' then 2 when 'z' then 3 else 0 end from dual; |