Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Implicit Date conversion problem
Raj,
you are forgetting how dates are stored internally vs. how they are displayed by sqlplus.
change your first query to:
select ea1.ep_number, ea1.est_dt, veas.est_dt from (select a.ep_number, ea.est_dt
from v_episode_avail_summary_break a, episode_airings ea where a.ep_number = ea.ep_number and ea.est_dt between to_date('20-Dec-2002','dd-mon-yyyy') and to_date('01-Jan-2003' ,'dd-mon-yyyy') group by a.ep_number, ea.est_dt) veas, episode_airings ea1
Your selection was not working properly because you ended up comparing string values with string values.
example: 21-Dec-2002 is not between 20-Dec-2002 and 01-Jan-2003 using string comparison
(21 is greater than 20 and 01 both).
hope this helps.
Tom Mercadante
Oracle Certified Professional
-----Original Message-----
Sent: Tuesday, October 29, 2002 8:54 AM
To: Multiple recipients of list ORACLE-L
We have a query (please don't ask me why it is written this way)
--Doesn't work:
select ea1.ep_number, ea1.est_dt, veas.est_dt
from (select a.ep_number, ea.est_dt
from v_episode_avail_summary_break a, episode_airings ea where a.ep_number = ea.ep_number and ea.est_dt between '20-Dec-02' and '01-Jan-03' group by a.ep_number, ea.est_dt) veas, episode_airings ea1
vs.
--Works:
select ea1.ep_number, ea1.est_dt, veas.est_dt
from (select a.ep_number, ea.est_dt
from v_episode_avail_summary_break a, episode_airings ea where a.ep_number = ea.ep_number and ea.est_dt between '20-Dec-02' and '01-Jan-03' group by a.ep_number, ea.est_dt) veas, episode_airings ea1
and trunc(to_date('01-Jan-03','DD-Mon-YY'))
Also if we comment "and ea1.est_dt between '20-Dec-02' and '01-Jan-03'" the
non-working query runs fine.
Does anyone know what could be wrong? The est_dt is a date column. This is
9201 ...
Raj
QOTD: Any clod can have facts, but having an opinion is an art!
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Mercadante, Thomas F
INET: NDATFM_at_labor.state.ny.us
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting servicesto: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Oct 29 2002 - 09:34:37 CST
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
![]() |
![]() |