I have an sql query that casts 2 dates and checks if they are equal. But even though the dates are equal, i dont get the result.
create or replace
FUNCTION
I am guessing that you are using Oracle. If so, the DATE data type contains a time component. This is rather confusing. But you could do what you want using TRUNC() rather than CAST():
SELECT TRUNC(HOLIDAY_DATE), DATE '2011-04-16' --into DAY_COUNT
FROM ATL_JOB_HOLIDAY jh JOIN
ATL_MASTER_JOB mj
ON mj.MASTER_JOB_ID = jh.MASTER_JOB_ID
WHERE TRUNC(HOLIDAY_DATE) = DATE '2011-04-16';
Note also the preference for ANSI standard dates and for table aliases.