I am getting 'not a valid month' error for the following code:
SELECT last_name, employee_id, hire_date
FROM employees
WHERE EXTRACT(YEAR FROM TO_DATE(hire_date, 'DD-MON-RR')) > 1998
ORDER BY hire_date;
Assuming this is the employees
table from Oracle's tutorial, hire_date
is already a date
column. You don't need to use to_date
on it:
SELECT last_name, employee_id, hire_date
FROM employees
WHERE EXTRACT(YEAR FROM hire_date) > 1998
ORDER BY hire_date;