Happy new year all. I have the following functions, which appears to work fine. When I change it to try and RETURN a BOOLEAN it doesn't compile.
How can I change the function to return a BOOLEAN (Y OR N). Thanks to all who respond.
create or replace function is_weekend (par_date in date) RETURN VARCHAR2 is
begin
return case when to_char(par_date, 'fmDAY', 'nls_date_language = english') in ('SATURDAY', 'SUNDAY')
then
'Y'
else 'N'
end;
end;
/
select rownum, trunc(sysdate) -10 + rownum as dt, is_weekend(trunc(sysdate) -10 + rownum) as weekend
from dual
connect by level <= 20;