user7218356
user7218356

Reputation: 5

SQL MONTH() NOT WORKING

I'm trying to select people hired in May but my (MONTH(HIRE_DATE) = 05) doesn't work

SELECT EMPLOYEE_ID AS "Employee Number", LAST_NAME ||', '|| FIRST_NAME AS 
"Full Name", JOB_ID, '[' || TO_CHAR(HIRE_DATE, 'Month fmddth "of" YYYY') ||']' AS "Hire Date"
FROM EMPLOYEES
WHERE (HIRE_DATE NOT BETWEEN TO_DATE('01/01/1994','DD/MM/YYYY') AND 
TO_DATE('31/12/1995','DD/MM/YYYY')) AND
(MONTH(HIRE_DATE) = 05)

Upvotes: 0

Views: 3434

Answers (1)

user5683823
user5683823

Reputation:

There is no MONTH() function in Oracle.

Both to_char(hire_date, 'mm') = '05' and extract (month from hiredate) = 5 should work.

Upvotes: 3

Related Questions