Last Day Last Month - Query Assistance

From: master44 <trpost_at_gmail.com>
Date: Fri, 31 Jul 2009 16:36:41 -0700 (PDT)
Message-ID: <87094411-ee4f-4c78-a858-7d6530ffe28b_at_c29g2000yqd.googlegroups.com>



I put a query together to pull the last day of last month that has worked fine for the last 2 months, but suddenly failed today now that the date is the 31st of the month:

SELECT TO_DATE(TO_CHAR(LAST_DAY(SYSDATE + numtoyminterval(-1, 'MONTH')), 'YYYY-MM-DD'), 'YYYY-MM-DD') FROM DUAL What am I doing wrong??

Eunning this against a Oracle 10G database, sorry don't know the exact version. Received on Fri Jul 31 2009 - 18:36:41 CDT

Original text of this message