effect of nls_territory

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
amoroder
Posts: 30
Joined: Sun 12 Sep 2010 11:33

effect of nls_territory

Post by amoroder » Mon 19 Dec 2016 09:40

Hello,

in the last weeks we have a strange problem with a simple query with this where statement
where nvl(:p_Data, trunc(sysdate)) between co_naz_inizio and
nvl(co_naz_fine, nvl(:p_Data, trunc(sysdate)))

We get the message ORA 01801 date format too long when we pass no value to :p_data.
I tried to solved it by adding to_date

select * from codif_nazioni
where nvl(to_date(:p_Data,'DD.MM.YYYY'), trunc(sysdate)) between co_naz_inizio and
nvl(co_naz_fine, nvl(to_date(:p_Data,'DD.MM.YYYY'), trunc(sysdate)))

and it works as long as NLS_TERRITORY is not set.
We have one location where this is set and on this DB the query returns no records.
This location does not get the ORA 01801

Can you tell me why the NLS_TERRITORY changes the behaviour of this simple query?

Thanks
Andreas

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: effect of nls_territory

Post by MaximG » Tue 20 Dec 2016 09:41

Please specify what type in your project has the :p_Data ? parameter. In case if DataType=ftDate then some additional conversion (to_date(:p_Data,'DD.MM.YYYY') is not required.

Post Reply