RE: Languages

From: Flado <>
Date: Fri, 10 Oct 2008 11:42:55 +0200
Message-ID: <>

> 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;


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.



Received on Fri Oct 10 2008 - 04:42:55 CDT

Original text of this message