As already explained in other answer about the difference between 'YY'
and 'YYYY'
format and its implications. You could easily avoid problems by using the ANSI DATE literal:
DATE '1989-09-21'
The ANSI date literal contains no time portion, and must be specified in exactly this format ('YYYY-MM-DD')
.
Also, HIRE_DATE
is a DATE data type which also has a time portion. Therefore, your WHERE condition might not return correct values:
WHERE HIRE_DATE = TO_DATE('21-09-1989','DD-MM-YY')
To remove the time portion you must use TRUNC to compare with only date portion:
WHERE TRUNC(HIRE_DATE) = DATE '1989-09-21'