Skip to content
September 13, 2012 / doganay

ORA-01841: (full) year must be between -4713 and +9999


Problem:

You get this error when selecting a date field or to_date converted field:

ORA-01841: (full) year must be between -4713 and +9999


Solution:

Probably you use varchar instead of date, it is a problem indeed.
use “>” and “<” operators and do not use to_date or to_char.

Do not forget:

You must use YYYYMMDD if you want to order dates.
(20050101>20020102 is ok for string comparision, but 01012005>02012002 is not!)

Example:

SELECT * FROM mytable
WHERE date_field1 > '20020102' and date_field1 < '20050101'
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: