开发者

Oracle to_char bug

开发者 https://www.devze.com 2023-04-09 03:45 出处:网络
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 recogn

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 beca开发者_StackOverflow社区use 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...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号