Hi everyone,
I have the 'EMPLOYEES' table, and i want to know who are the employees whose birthday falls in next 7 days.
So for that i created this query:
SELECT *
FROM employees
WHERE (EXTRACT (MONTH FROM birth_date) * 31
+ EXTRACT (DAY FROM birth_date) >=
EXTRACT (MONTH FROM SYSDATE) * 31 + EXTRACT (DAY FROM SYSDATE)
AND EXTRACT (MONTH FROM birth_date) * 31
+ EXTRACT (DAY FROM birth_date) <=
EXTRACT (MONTH FROM SYSDATE + 6) * 31
+ EXTRACT (DAY FROM SYSDATE + 6));
But the problem is:
The query works only if SYSDATE is between'01/01/2018' and '31/12/2018', but when the sysdate = '01/01/2019' the query doesnt work anymore.
Thank you for help.