Re: to_char() accepting invalid dates?

From: "THOMPSON, JARED (ATTBAPCO)" <JT060b(at)ATT(dot)COM>
To: <spam_eater(at)gmx(dot)net>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: to_char() accepting invalid dates?
Date: 2011-07-29 17:48:50
Message-ID: 377C0288D30BE04BA7B5FD60BDFC0C911A6F7040@crexc52p
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

ERROR at line 1:
ORA-01839: date not valid for month specified


That error is coming on
select to_date('20110231', 'YYYYMMDD') from dual;

because there are not 31 days in February 2011, try this:

select to_date('20110228', 'YYYYMMDD') from dual;

Jared Thompson
Internet Operations Group
Office: 678.406.2895
jt060b(at)att(dot)com <mailto:kyle(dot)dungan(at)att(dot)com>


This e-mail and any files transmitted with it are AT&T property, are
confidential, and are intended solely for the use of the individual or
entity to whom this email is addressed. If you are not one of the named
recipient(s) or otherwise have reason to believe that you have received
this message in error, please notify the sender and delete this message
immediately from your computer. Any other use, retention, dissemination,
forwarding, printing, or copying of this e-mail is strictly prohibited.

Browse pgsql-sql by date

  From Date Subject
Next Message Wes James 2011-08-01 22:50:00 why these results?
Previous Message Johann Spies 2011-07-28 11:20:21 Help with regexp-query