I am trying to insert/update DATE_OF_RETIREMENT column, but when the year is >=2050, it takes as 1950.
Example:
UPDATE EMPLOYEE
SET STATUS = '4',
ISACTIVE = 1,
DATE_OF_RETIREMENT = '30-APR-49'
WHERE ID = 2001;
Here DATE_OF_RETIREMENT is updated with 30 APR 2049.
But in following case:
UPDATE EMPLOYEE
SET STATUS = '4',
ISACTIVE = 1,
DATE_OF_RETIREMENT = '30-APR-52'
WHERE ID = 2001;
Here DATE_OF_RETIREMENT with updated with 30 APR 1952.
Can anyone tell me the reason why this is happening?
Use 4 digits for years; I hope you aren't trying to save some disk space, are you? Y2K is 20 years behind us.
See the difference between
RRandYYformat mask for years. Depending on whether it (year) is before or after the 50th year in the century, you'll get a different result.