This is old college assignment am doing to sharpen my sql skills, its cat test centre and this funtion is checking if the mechanic is available on certain date which is input from user in the anonymous block. the problem i m having durning testing is that the function result will only return false and the data inputs are correct
create or replace
FUNCTION MECH_AVAILABLE(mech_id in MECHANIC.MECHANIC_ID%TYPE,
todays_date in UNAVAILABILITY.UNAVAILABLE_DATE%TYPE)
return boolean
is
temp UNAVAILABILITY.UNAVAILABLE_DATE%TYPE;
begin
select unavailable_date
into temp
from unavailability
where mechanic_id = mech_id;
if todays_date = temp
then
RETURN true;
else
return false;
end if;
end mech_available;