Re: ORA-01843: not a valid month
Date: Tue, 17 Jan 2023 20:18:52 +0000 (UTC)
Message-ID: <1091072022.2240224.1673986732061_at_mail.yahoo.com>
Ilmar
I am running the Test Query from the same client remotely using Sqlplus or even Toad.
Sanjay
On Tuesday, January 17, 2023 at 01:32:19 PM EST, Ilmar Kerm <ilmar.kerm_at_gmail.com> wrote:
NLS session parameters are set by the client - check client OS environment, java regional settings, ....
On Tue, Jan 17, 2023 at 6:46 PM Sanjay Mishra <smishra_97_at_yahoo.com> wrote:
Thanks Ilmar for the details. I am trying to check what is different in the environment as Code/SQL is generated using 3rd Party application and so cannot change, It is working in a lower environment but failed in Perf testing. I can see that using timestamp or nls_timestamp_format, it is working but as code cannot be changed and so was trying to see what is impacting it
Sanjay On Tuesday, January 17, 2023 at 12:22:02 PM EST, Ilmar Kerm <ilmar.kerm_at_gmail.com> wrote:
You pass the timestamp value as a string not as a timestamp, so it is subject to SESSION nls timestamp formatting rules.Never rely on "magic" implicit datatype conversions - you'll be subject to inconsistent behaviour like this.Instead of '2023-01-12 01:01:01.122' you can write timestamp'2023-01-12 01:01:01' or use to_timestamp() function.
https://oracle-base.com/blog/2020/07/08/when-implicit-date-conversions-attack/
"Relying on an implicit conversion is *ALWAYS* a bug waiting to happen."
On Tue, Jan 17, 2023 at 6:03 PM Sanjay Mishra <dmarc-noreply_at_freelists.org> wrote:
Hi
TIASanjay
--
--
I had Dev and Perf setup where one of the Application Column is TIMESTAMP and the query is giving an error in Perf but working in Dev
select cname,cvalue from ptran.qtransaction where cdatetime <= '2023-01-12 01:01:01.122'ERROR at line 1:ORA-01843: not a valid month
It is working fine in other databaseDatabase Parameter are same in bothNLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZRNLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZRNLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AMNLS_TIME_FORMAT HH.MI.SSXFF AM
show parameter nlsSQL> show parameter nls
PARAMETER_NAME TYPE VALUE------------------------------------------------------------ ----------- ----------------------------------------------------------------------------------------------------nls_calendar string GREGORIANnls_comp string BINARYnls_currency string $nls_date_format string YYYY-MM-DD HH24:MI:SSnls_date_language string AMERICANnls_dual_currency string $nls_iso_currency string AMERICAnls_language string AMERICANnls_length_semantics string CHARnls_nchar_conv_excp string FALSEnls_numeric_characters string .,nls_sort string BINARYnls_territory string AMERICAnls_time_format string HH.MI.SSXFF AMnls_time_tz_format string HH.MI.SSXFF AM TZRnls_timestamp_format string DD-MON-RR HH.MI.SSXFF AMnls_timestamp_tz_format string DD-MON-RR HH.MI.SSXFF AM TZR
Ilmar Kerm
Ilmar Kerm
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Jan 17 2023 - 21:18:52 CET