Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

TO_CHAR within DECODE

547305Nov 24 2006 — edited Nov 24 2006
The 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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 22 2006
Added on Nov 24 2006
4 comments
1,987 views