ORA-01841: (full) year must be between -4713 and +9999
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 1
- Joined: Tue Nov 14, 2006 6:10 pm
- Location: Brisbane
ORA-01841
Hi, I remember getting this error while using TO_DATE() in a stored procedure a while ago:
"ORA-01841: (full) year must be between -4713 and +9999, and not be 0"
The issue is because TO_DATE() expects to work on a CHARACTER data type and so there is an implicit conversion from DATE to CHAR.
For the example whenever there is a date value with year 2000, it is implicitly converted to the character string "date-month-00",
which is then converted back to a date using a DD-MON-YYYY date format. This gives a year of 0000 which is invalid, hence you get an error ORA-1841.
Hope this helps
"ORA-01841: (full) year must be between -4713 and +9999, and not be 0"
The issue is because TO_DATE() expects to work on a CHARACTER data type and so there is an implicit conversion from DATE to CHAR.
For the example whenever there is a date value with year 2000, it is implicitly converted to the character string "date-month-00",
which is then converted back to a date using a DD-MON-YYYY date format. This gives a year of 0000 which is invalid, hence you get an error ORA-1841.
Hope this helps
Abhinav Sharma
Developer
Developer