Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Date conversion in plsql YYYYMM
"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