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: Date conversion in plsql YYYYMM

Re: Date conversion in plsql YYYYMM

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Fri, 26 Mar 2004 08:02:07 +0100
Message-ID: <4063d554$0$9116$626a14ce@news.free.fr>

"liglin" <liglinlillibli_at_hotmail.com> a écrit dans le message de news:db9bdb31.0403252224.28790926_at_posting.google.com...
> Thanks Michel,
>
> In the meanwhile I found still another solution:
>
>
> TO_DATE(TR.TR_BEG_DATE, 'YYYYMM01'
This is a bad solution as it relies on an implicit conversion date->char and then on your current date format.
If there is an incompatibility between this latter (given by the NLS_DATE_FORMAT parameter) and 'YYYYMM01' then you'll get an error.
For instance, try alter session set nls_date_format='DD-MON-YYYY' before your statement and you'll see what i mean.

Regards
Michel Cadot

>
> converts a date into a date that begins with the first day of the
> month. Unfortunately, this presumes that the given date is 8 digits
> long. It won't work if the day is missing and the date consists of
> only 6 digits.
>
> Thanks,
>
> Liglin.
>
>
Received on Fri Mar 26 2004 - 01:02:07 CST

Original text of this message

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