RE: Languages

From: Flado <vandreev_at_gmail.com>
Date: Fri, 10 Oct 2008 11:42:55 +0200
Message-ID: <442adaf60810100242k7716bee1r16124afa3f3be7f2@mail.gmail.com>


>
> This seems to be a NLS environment issue. Try setting nls_date_format and/or
> nls_language.
>
>

*nls_date_language* is the variable you are looking for. However, its value depends on too many things (for OCI - on the environment of the client executable; don't know about JDBC Thin) and it may be different for two different sessions running the same code.

So, Mário, you have two options to make this code run consistently: a) set the nls_date_language session parameter to 'ENGLISH' or 'AMERICAN' prior to running next_day() via *alter session*, or b) do a double conversion of a known Friday (e.g., today, 10.10.2008: to_char(to_date('20081010', 'YYYYMMDD'),'Dy') )

11:37:49 flado_at_l008>alter session set nls_date_language='PORTUGUESE'; 11:38:03 flado_at_l008>SELECT NEXT_DAY(SYSDATE, 'FRI') FROM dual; SELECT NEXT_DAY(SYSDATE, 'FRI') FROM dual

                         *

ERROR at line 1:
ORA-01846: not a valid day of the week

11:38:09 flado_at_l008>SELECT NEXT_DAY(SYSDATE, to_char(to_date('20081010', 'YYYYMMDD'),'Dy')) FROM dual;

NEXT_DAY(SYSDATE,TO



2008-10-17 11:45:01

Personally, I prefer option b) since it doesn't require me to save the previous setting and restore it back afterwards, and it doesn't need one or two extra statements.

Cheers!

Flado

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Oct 10 2008 - 04:42:55 CDT

Original text of this message