declare
WorkDay date;
begin
for i in -5..5 Loop
WorkDay := add_months(sysdate,i);
DBMS_Output.Put_Line('---' || to_char(WorkDay,'yyyy"年"mm"月"') || '---');
for WorkCursor in (
select next_day(Last_day(WorkDay),1)-7 as Sunday from dual
union select next_day(Last_day(WorkDay),1)-7*2 from dual
union select next_day(Last_day(WorkDay),1)-7*3 from dual
union select next_day(Last_day(WorkDay),1)-7*4 from dual
union select next_day(Last_day(WorkDay),1)-7*5 from dual
where to_char(Last_day(WorkDay),'MM') =
to_char(next_day(Last_day(WorkDay),1)-7*5,'MM')
order by 1) Loop
DBMS_Output.Put_Line(to_char(WorkCursor.Sunday,'yyyy/mm/dd'));
end Loop;
end Loop;
end;
/