Re: Y2K Date Issues with Oracle 7.3.4
Date: Thu, 20 Jan 2000 13:16:38 GMT
Message-ID: <8671ra$1r$1_at_nnrp1.deja.com>
Alexander,
On one level I would agree with you, on another it can be argued that real world programmers are often concerned only with obtaining a result that is correct today. That is to say, if they get the correct result, they do not always ask if that result came from correct logic or from incorrect logic that only worked because of some outside circumstance. The code Sofia submitted would have worked perfectly in many cases prior to 1/1/2000. So would the code in Todd's original question. The lethal 'fix' for Sofia's error that I submitted would actually give correct answers in a few cases. This obviously does not mean the logic of any of these was correct; merely that the errors, especially the original one, were less likely to be noticed and corrected. Therefore, IMHO, the WHY may be of only academic interest, but if specific errors in output begin to show up, knowing at least one of the coding errors that can cause them is beneficial and knowing what NOT to do to fix them can save time an aggravation.
The real message here is that in Oracle systems you can never go
wrong if you always pass a date as AND accept a date from, a character
string with a 4 digit year and use the same character string
consistently:
param1 := TO_CHAR(SYSDATE,'MMDDYYYYHH24MISS');
new_date := TO_DATE(param1,'MMDDYYYYHH24MISS');
Any method that relies on factors outside the programmers direct and
continual control, such as NLS_DATE_FORMAT, is subject to failure.
I'll get down off my soapbox now.
Have a nice day,
Paul
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Thu Jan 20 2000 - 14:16:38 CET