Re: [cx-oracle-users] Query returns zero rows via cx_oracle but some from sql developer
Brought to you by:
atuining
From: Doug H. <djh...@te...> - 2011-03-03 01:34:57
|
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. -- Doug Henderson, Calgary, Alberta, Canada |