Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
create or replace function Count_DoW (date_in date, Day_of_Week varchar2) return number is
begin
if date_in is null then return null;
end if;
If to_char(next_day(trunc(date_in,'MM')-1
,substr(Day_of_week,1,3))+21,'DD')
<= to_char(last_day(date_in),'DD')-7 then
return 5;
else
return 4;
end if;
end;
/
Function created.
clear col
col a heading "Number|of Mondays|in July"
col b heading "Number|of Mondays|in August"
select count_dow(sysdate,'MON') a, count_dow(sysdate+30,'MON') b
from dual;
Number Number
of Mondays of Mondays
in July in August
---------- ----------
5 4