Re: [cx-oracle-users] Query returns zero rows via cx_oracle but some from sql developer
Brought to you by:
atuining
From: Himanshu <him...@gm...> - 2011-03-03 11:10:00
|
On 3 March 2011 06:49, Doug Henderson <djh...@te...> wrote: > On 2011-03-01 02:59, Amaury Forgeot d'Arc wrote: > > Hi, > > > > 2011/3/1 Himanshu <him...@gm...>: > >> WHERE log_date >= '10-Feb-11' > >> AND log_date <= '10-Feb-11' > > You should avoid date literals in SQL statements. The exact format may > > depend on environment > > variables (language...) and other Oracle client settings. > > Use something like to_date('10-02-2011', 'DD-MM-YYYY') > > Also, this WHERE clause only selects lines where "log_date" has no > > time (or midnight). > > Is it really the case in your data? > > > SQL Developer silently issues ALTER SESSION commands based on the > settings in the Tools-Preferences dialog, NLS panel. It can also import > login scripts, which might contain alter session commands. All this in > addition to the impact of environment variables, and even windows > registry settings. > > Your date literals may not be interpreted in the way you expect. > > Try using the DATE'yyyy-mm-dd' format, or provide an explicit conversion > for your date literals. > Thanks a lot for the reply. The problem was just this behavior of sql developer. It had some permissions which my python code didn't have for the same user. It worked on doing a grant select on one of the tables. Further investigation needed but I am done for now. Thanks, Himanshu |