Below query returns the result:
SELECT *
FROM EMPLOYEES
WHERE HIRE_DATE = TO_DATE('21-09-1989','DD-MM-YY');
where as if I change the date from 21-09-1989 to 21-09-89 returns nothing.
SELECT *
FROM EMPLOYEES
WHERE HIRE_DATE = TO_DATE('21-09-89','DD-MM-YY');
What is the issue here?
If you use the
YYas the year then it returns the year which is in the current century i.e.2000-2099. In your case-- 2089If you use the
YYYYthen the exact year is returned. -- in your case1989If you use
RRthen the year which is between1950-2049is returned. -- in your case1989So