[英]Oracle to_char bug
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 我不知道这是一个bug还是什么,但是当我尝试使用Oracle中的to_char函数以某种方式格式化星期几时,SQL Plus会给我这个错误:ORA-01821:日期格式无法识别
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. 所以d是'星期几'而sp是拼写。 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!! dd是'每月的一天'所以sql加上打印二十九没有任何问题!!
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... 对我来说看起来像个错误......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.