Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: New century - URGENT
Hi Ari !
That will not work, if the year stored has only to digits. Let's alterate your TO_DATE:
TO_DATE(SUBSTR(string,1,length(string)-2) || '19' || SUBSTR(string,length(string)-1),'DD-MON-YYYY') assuming that date is in 19th century.
Regards
Dante A. Notari-Locher
Ari Kaplan wrote:
> Angela Maria dos Santos (amsantos_at_intra.singer.com.br) wrote:
> : We have various programs (PL/SQL, SQL, FORMS/3 and REPORT/1), that
we
> : must to convert to year 2000.
[snip]
> : stored with 2 positions for year, and convert for 4 positions.
[snip]
> Angela,
>
> To convert a string to a date format (for inserting into a DATE
> field), use:
>
> TO_DATE(string,'DD-MON-YYYY')
>
> To convert a date field (such as SYSDATE) to a string, use:
>
> TO_CHAR(date_field,'DD-MON-YYYY')
>
> This will assume a date in the format of "18-SEP-1997". There are
> other options for
> formatting. See my web page more much more information on this
> subject.
>
> -Ari Kaplan
> Independent Oracle DBA Consultant
[snip]
>
Received on Tue Sep 23 1997 - 00:00:00 CDT
![]() |
![]() |