TO_CHAR within DECODE
547305Nov 24 2006 — edited Nov 24 2006The following script if not working:
select decode(
to_char(sysdate, 'DAY'),
'SUNDAY', 0,
'MONDAY', 1,
'TUESDAY', 2,
'WEDNESDAY', 3,
'THURSDAY', 4,
'FRIDAY', 5,
'SATURDAY', 6,
-1) from dual;
It is returning -1 instead of 5.
However replacing to_char() with 'FRIDAY' works fine. What am I doing wrong here?