Sysdate to_char DAY conversion not comparable [message #644972] |
Mon, 23 November 2015 00:27  |
 |
Rishab_le_noob
Messages: 12 Registered: November 2015 Location: Kolkata
|
Junior Member |
|
|
Hi Friends,
This is a weird behavior/bug I found in Oracle 10g and 11g.
Issue: When we try to compare a date's weekday using the TO_CHAR(DAY) keyword, it fails. But it works fine with TO_CHAR('DY').
Anyone else faced this issues?
You guys think this is a bug?
Query:
select to_char(sysdate,'dd-mm-yyyy day') ,
case
when to_char(sysdate,'day')='monday' then 'Takes the 1st one'
when to_char(sysdate,'dy')='mon' then 'Takes the 2nd one'
end
from dual;
Result:
Takes the 2nd one
Where as it should have returned the 1st result : 'Takes the 1st one'
Thank You
Rishab
[Updated on: Mon, 23 November 2015 01:21] Report message to a moderator
|
|
|
|
|
|
|
|
|
|