Re: Y2K Date Issues with Oracle 7.3.4

From: <pberetta_at_my-deja.com>
Date: Sat, 15 Jan 2000 21:39:22 GMT
Message-ID: <85qpe9$9lk$1_at_nnrp1.deja.com>


Sofia,

[Quoted]    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,
Paul

In article <85qgh1$2nf2$1_at_ulysses.noc.ntua.gr>,   "Sofia" <sofia_at_eexi.gr> wrote:
> interesting fact:
>
> If you cast "to_date" a date variable (don't ask me why you would
> like to do that), then no matter how much care you took in placing
> the correct date in the variable, the result will be a date after
2000.
>
> For example
>
> a_date DATE;
>
> a_date := to_date('12/10/1998','DD/MM/YYYY');
> a_date := to_date(a_date);
>
> now a_date has a 12/10/2098 value!
>
> Steve McDaniels <steve.mcdaniels_at_sierra.com> wrote in message
> news:85lnet$lki$1_at_plo.sierra.com...
> > We simply use 'YYYY' in all date conversions
> >
> > to_date('01-JAN-1999','DD-MON-YYYY')
> > and
> > to_char(sysdate,'DD-MON-YYYY')
> >
> >
> >
> > Mungo Henning <mungoh_at_itacs.strath.ac.uk> wrote in message
> > news:387DE3D7.B44F28B1_at_itacs.strath.ac.uk...
> > >
> > >
> > > James Lorenzen wrote:
> > >
> > > > [good stuf snipped]
> > >
> > > Just a little warning: remember that the RR format is fine
for "recent"
> > > dates,
> > > but if you have anyone born before 1950 (data for insurance
policies
> etc)
> > > then the RR format will give you grief when it interprets "49" as
> "2049".
> > >
> > > Mungo
> > >
> > > --
> > > Mungo Henning - it's a daft name but it goes with the face...
> > > mungoh_at_itacs.strath.ac.uk.http://www.itacs.strath.ac.uk/
> > > I speak for me, not my employer.
> > >
> > >
> >
> >
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Sat Jan 15 2000 - 22:39:22 CET

Original text of this message