PL SQL Printing Dates in a Month

— anonymous block to print of dates in a month

 som date; --start of month
 eom date; --end of month
 tmp date;
 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
   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;

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s