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(sysdate,'DAY') as a predicate

wtlshiersMay 7 2013 — edited May 7 2013
I was working with a SQL statement trying to use TO_CHAR(SYSDATE,'DAY') to get all rows from a table where a specific column holds the day of the week (as the literal - i.e. TUESDAY). However - it wasn't working... So - I tried the following:

select sysdate from dual
where 'TUESDAY' = TO_CHAR(sysdate,'DAY');
Which didn't return any rows either...

However (not that this is what I was trying to do) this does work:
select sysdate from dual
where '3' = TO_CHAR(sysdate,'D');
I'm obviously missing something here... I don't understand why the first SQL doesn't work.

Can someone tell me what I'm missing?

Oracle Version 11.2.0.1
This post has been answered by John Stegeman on May 7 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 4 2013
Added on May 7 2013
5 comments
631 views