Re: Y2K Date Issues with Oracle 7.3.4

From: Alexander I. Doroshko <aid_at_grant.kharkov.ua>
Date: Tue, 18 Jan 2000 10:56:54 +0200
Message-ID: <8619lj$kt0_at_grant.grant.UUCP>


Nothing bizarre. When You call TO_DATE with the first argument of DATE type, implicit conversion to CHAR type occurs, using Your NLS_DATE_FORMAT. If NLS_DATE_FORMAT='DD/MM/YY', the expression in the line 9 is equivalent to
to_date('12/10/98', 'DD/MM/YYYY'), which gives exactly 0098, because too short
elements are left-padded with '0'.
And the line 6 is equivalent to
 to_date('12/10/98', 'dd/mm/yy'), which gives 2098. So, everything is in strict accordance with the docs. But IMHO, experiments with using to_date with DATE argument are of purely academic interest.
<pberetta_at_my-deja.com> wrote in message news:85qpe9$9lk$1_at_nnrp1.deja.com...
> Sofia,
> And if you want to see something even more bizarre, look at what
> happened when I tried to prevent the century shift by specifying a
> format mask when TO_DATEing the date:
>
> SQL> DECLARE
> 2 a_date DATE;
> 3 BEGIN
> 4 a_date := to_date('12/10/1998','DD/MM/YYYY');
> 5 DBMS_OUTPUT.PUT_LINE(to_char(a_date,'DD/MM/YYYY'));
> 6 a_date := to_date(a_date);
> 7 DBMS_OUTPUT.PUT_LINE(to_char(a_date,'DD/MM/YYYY'));
> 8 a_date := to_date('12/10/1998','DD/MM/YYYY');
> 9 a_date := to_date(a_date,'DD/MM/YYYY');
> 10 DBMS_OUTPUT.PUT_LINE(to_char(a_date,'DD/MM/YYYY'));
> 11 END;
> 12 /
> 12/10/1998
> 12/10/2098
> 12/10/0098
>
> PL/SQL procedure successfully completed.
>
> Now where in heck did that 0098 come from? Proving once again you have
> to be VERY careful what you ask for when it comes to date I/O in Oracle.
> Hope this gives you a chuckle,
Received on Tue Jan 18 2000 - 09:56:54 CET

Original text of this message