article

Resolution to the

Email
Submitted on: 2/2/2015 3:13:00 PM
By: John Galanopoulos (from psc cd)  
Level: Intermediate
User Rating: By 3 Users
Compatibility: VB 5.0, VB 6.0, VB Script, ASP (Active Server Pages)
Views: 2413
 
     Finally a valid resolution to this strange Oracle error.

 
				

The "ORA-01843" Error; How-Not-To

I have seen many developers (specifically those who deal with ORACLE backends) 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.

For some strange reason, Oracle seems to react with your date format 'mm/dd/yyyy' (or 'dd/mm/yyyy')
and raises this error.

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".

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.

I went back to my source and after the line where my connection to the ORACLE database was initialized, i wrote :

strSQL = "ALTER SESSION SET NLS_DATE_FORMAT = 'DD/MM/YYYY'"

{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}.

myOraDB.ExecuteSQL (strSQL)

Guess what ppl. It worked!

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 :-)


More oracle tips at http://aboutoracle.blogspot.com


Other 9 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.