Re: ORA-01861: literal does not match format string

From: Carlos <miotromailcarlos_at_netscape.net>
Date: Tue, 10 Feb 2009 06:28:36 -0800 (PST)
Message-ID: <6851b08b-ae18-4ae1-833b-03ef8a9bc0ee_at_g38g2000yqd.googlegroups.com>



On 10 feb, 15:27, Noons <wizofo..._at_yahoo.com.au> wrote:
> shweta.kapar..._at_googlemail.com wrote,on my timestamp of 11/02/2009 1:05 AM:
>
>
>
>
>
> > SQL> select * from T1 where last_update=to_date('2008-02-10
> > 05:59:17','yyyy-mm-dd hh24:mi:ss');
> > NAME TYPE VALUE
> > ------------------------------------ -----------
> > ------------------------------
> > nls_calendar string
> > nls_comp string
> > nls_currency string
> > nls_date_format string dd-mon-rrrr
> > nls_date_language string
> > nls_dual_currency string
> > nls_iso_currency string
> > nls_language string american
> > nls_length_semantics string byte
> > nls_nchar_conv_excp string FALSE
> > nls_numeric_characters string ,.
> > nls_sort string
> > nls_territory string america
> > nls_time_format string
> > nls_time_tz_format string
> > nls_timestamp_format string
> > nls_timestamp_tz_format string
>
> > SQL>
>
> > We cannt chnage the java code immediately to use to_date.
> > so how to avoid such error:?
>
> Set your nls_date_format parameter to match what you are using in java:
>
> alter system set nls_date_format=
> 'yyyy-mm-dd hh24:mi:ss' scope=both;
>
> Be aware that this changes the default date format for ALL sessions and users in
> future.
> If you only want it for the java session(s), then you must find a way to add a
> alter session for the same parameter to set the format for only those.

You can set an Environment Variable at the client side

% NLS_DATE_FORMAT='YYYYMMDD'
% export NLS_DATE_FORMAT

as explained in:

http://download.oracle.com/docs/cd/B28359_01/server.111/b28319/ldr_modes.htm#i1011158

HTH. Cheers.

Carlos. Received on Tue Feb 10 2009 - 08:28:36 CST

Original text of this message