Unexpected result calc in dates
Hi everybody.
I'm confused about the results in a query.
I'm using decode to calculate the value of "COND" column, knowing today is "Friday"
SELECT TO_CHAR (SYSDATE, 'Day') COND FROM DUAL
But when I'm decoding this sentence in a query,
SELECT DECODE (TO_CHAR (SYSDATE, 'Day'), 'Friday', 'Today', 'Rest of week') COND FROM DUAL
I expected to get "Today" as the result, but what I obtain is "Rest of week"
First I thought in an error, but if I use a sustitution variable instead,
SELECT DECODE (:DD, 'Friday', 'Today', 'Rest of week') COND FROM DUAL
the result is the correct ("Today")
What am I doing wrong?
Thanks a lot