in reply to CGI-SQL Query Issue
The SQL itself is bad. Double-quotes are used for identifiers, single-quotes are used for data. Sqlplus should have barfed with a very clear error message:
ERROR at line 1: ORA-00904: "yyyymmdd": invalid identifier
So, instead of "yyyymmdd", use 'yyyymmdd'. Furthermore, '88888888' is confusing, as without significant change, the highest date in year 8888 would be 12/31.
But, that's not the best way to do it anyway. In general, you should avoid placing a function on a column in a where clause, both because it negates the use of (a non-function based) index, and because the function must be executed for every value. That a lot of wasted CPU time. Instead, place the functions on the values, so that the functions run only once:
end_date_time BETWEEN TO_DATE('00010101', 'YYYYMMDD') AND TO_DATE('88881231', 'YYYYMMDD')Fwiw, unless you specifically want to exclude all dates BCE, the between itself is redundant, and can be expressed:
end_date_time <= TO_DATE('88881231', 'YYYYMMDD')
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: CGI-SQL Query Issue
by Anonymous Monk on Mar 17, 2016 at 15:00 UTC | |
by poj (Abbot) on Mar 17, 2016 at 18:55 UTC | |
by Anonymous Monk on Mar 18, 2016 at 10:59 UTC | |
by Corion (Patriarch) on Mar 18, 2016 at 11:23 UTC | |
by Anonymous Monk on Mar 18, 2016 at 11:26 UTC | |
| |
by Anonymous Monk on Mar 18, 2016 at 11:10 UTC | |
by poj (Abbot) on Mar 18, 2016 at 11:33 UTC | |
by Anonymous Monk on Mar 18, 2016 at 12:15 UTC | |
| |
by chacham (Prior) on Mar 17, 2016 at 15:38 UTC |