PL SQL Printing Dates in a Month

— anonymous block to print of dates in a month

declare
 som date; --start of month
 eom date; --end of month
 tmp date;
begin
 select last_day(add_months(sysdate,-1))+1 into som from dual; --#current som
 select last_day(sysdate) into eom from dual;

 htp.print(TO_CHAR(SOM, 'FMDay, DDth Month YYYY'));
 tmp := som;
 while tmp < eom
  loop
   if lower(to_char(tmp,'FMDay')) = lower('sunday') then htp.print('-------------------------'); end if;
   tmp := tmp +1;
   htp.print(TO_CHAR(TMP, 'FMDay, DDth Month YYYY'));
  end loop;
end;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s