Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Y2K to_date SQL question

Re: Y2K to_date SQL question

From: replace this with _at_ <_at_)xs4all.nl>
Date: Thu, 15 Oct 1998 21:12:53 GMT
Message-ID: <36263776.1523009@news.xs4all.nl>


Hi,

>select min(to_date(canyymmdd,'YYMMDD')) from mytable
>
>I realize I could modify the database so the field is yyyymmdd, but I'd
>rather not!

You should!

>Is there a SQL command that will return the earliest yymmdd
>for me, taking into account the fact that 000101 is greater than 991230?

You can use the 'old' trick that has been built in, the last decade. Here you suppose that every year after 80 is in the 20th century and the rest in the 21st.

select min(to_date(decode(sign(to_number(substr(canyymmdd,1,2))-80 , -1, '20', '19') || canyymmdd))
from yourtable;

I stongly advise you to change the database structure!


Received on Thu Oct 15 1998 - 16:12:53 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US