I don't know if it's a bug or what, but when I try to format the Day of the week in a certain way with the to_char function in Oracle, SQL Plus give me this error : ORA-01821: date format not recognized
Here's the line that cause a problem
SELECT TO_CHAR(sysdate,'dsp') from dual;
So d is of 'Day of the week' and sp is for spell. This line should print five because we are thursday.
It's weird because this next line worked
SELECT TO_CHAR(sysdate,'ddsp') from dual;
dd is for 'Day of the month' so sql plus printed twenty-nine without any problem!!
Can someone tell me why this line is not working?
Thanks..
If you must make this work, here's an ugly workaround:
SELECT to_char(to_date(to_char(SYSDATE,'d'),'j'),'jsp') FROM dual;
Looks like a bug to me...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With