Resolution to the "ORA-01843 Not a valid month" Error
Finally a valid resolution to this strange Oracle error.
AI
Résumé par IA: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Code source
<h2 style="COLOR: midnightblue">The "ORA-01843" Error; How-Not-To </h2>
<P> </P>
<P>I have seen many developers (<EM>specifically those who deal with ORACLE
backends</EM>) knocking themselves out (i was one of them) with this strange
error while trying to execute an SQL query with a date field in it. </P>
<P>For some strange reason, Oracle seems to react with your date format
'mm/dd/yyyy' (or 'dd/mm/yyyy') <br>and raises this error.</P>
<P>The first thing i did, was to check whether the registry value
HKEY_LOCAL_MACHINE\Software\ORACLE\nls_date_format was of the format
"dd/mm/yyyy".</P>
<P> And it was!! After i tried many things, i returned to that key and i
changed the format. Still nothing. This key seems to have no effect to the way
ORACLE databases handle date values.</P>
<P>I went back to my source and after the line where my connection to the
ORACLE database was initialized, i wrote :</P>
<P style="COLOR: mediumblue">strSQL = "ALTER SESSION SET NLS_DATE_FORMAT =
'DD/MM/YYYY'"</P>
<P>{The following line applies to Oracle Objects for OLE ( aka OO4O). If
you use ADO, RDO, DAO, ODBC API etc etc write it in it's relative format}.</P>
<P style="COLOR: mediumblue"> myOraDB.ExecuteSQL (strSQL)</P>
<P>
Guess what ppl. It worked!</P>
<P>All my Insert/Update/Delete SQL statements that included a date value where
properly inserted into the Oracle database table. No errors so no problems :-)</P>
Commentaires originaux (3)
Récupéré via Wayback Machine