Jan 162013
 
select last_day_of_the_month - 
       interval '1' month "throws ORA-01839"
from   months
where  total_days > prev_month_days;
Annoyingly, adding/subtracting intervals of a month just changes the month part of the date, 
without adjusting the days accordingly. You'll need to use add_months() if you want the days to be resolved

For a script to see this in action, use this.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)