为什么我会收到此错误:
Error starting at line 1 in command:
select name,major, lpad(to_char(date_birth,'dd'),10) "Date of birth",
to_char(next_day(date_birth,'sunday'),'dd') - to_char(date_birth,'dd') "Different in days"
from students
SQL错误:ORA-01846:不是一周中的有效日期 01846. 00000 - "不是一周中的有效日期"
当我运行以下查询时?
select name,major, lpad(to_char(date_birth,'dd'),10) "date of birth",
to_char(next_day(date_birth,'sunday'),'dd') - to_char(date_birth,'dd') "Different in days" from students
答案 0 :(得分:1)
尝试将next_day(date_birth,' sunday')更改为next_day(date_birth,1) - 1代表一周的第一天,即星期日
答案 1 :(得分:0)
您必须使用您在sql developer上设置的语言编写日期的名称,这很可能不是英语。 但最佳做法是设置整数,比如@ user4507518说。