DECODE output may be type sensitive
Assuming current months is MAY
Since MM format will return ’05’ it won’t match ‘5’ as shown below
select decode(to_char(sysdate,'MM'),'05','MAY','other month') from dual; --MAY select decode(to_char(sysdate,'MM'),'5','MAY','other month') from dual; -- other month
At the same time, if 05 or 5 will be used with decode instead of ’05’ or ‘5’ then both queries will give us the same result. It is happening because Oracle will implicitly adjust between character and numeric data types in this case.
select decode(to_char(sysdate,'MM'),05,'MAY','other month') from dual; --MAY select decode(to_char(sysdate,'MM'),5,'MAY','other month') from dual; --MAY