Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Problem comparing dates

Re: Problem comparing dates

From: Maxim Demenko <mdemenko_at_gmail.com>
Date: Thu, 21 Jul 2005 22:12:56 +0200
Message-ID: <dbovk3$jdf$01$1@news.t-online.com>


Rhugga wrote:
> I amtrying to select rows that fit a certain time period.
>
> My table:
> BCV_START DATE
> COL1 VARCAHR2
> COL2 VARCAHR2
>
> My data is inserted as follows:
>
> INSERT INTO MYTABLE VALUES ( to_date('2005-07-20 16:30:00', 'YYYY-MM-DD
> HH24:MI:SS', 'data', 'data')
>
> The following query is not behaving as expected:
>
> SELECT * FROM MYTABLE where to_date(bcv_start, 'DD-MON-YYYY HH24:MI') >
> to_date('20-JUL-2005 01:00', 'DD-MON-YYYY HH24:MI') AND
> to_date(bcv_start, 'DD-MON-YYYY HH24:MI') < to_date('20-JUL-2005
> 17:00', 'DD-MON-YYYY HH24:MI')
>
> What am I doing wrong here?
>
> Thx,
> CC
>

You should use it without to_date function around BCV_START.

(Maybe a little bit unclear expressed:
SELECT *
FROM MYTABLE
where
bcv_start > to_date('20-JUL-2005 01:00', 'DD-MON-YYYY HH24:MI') AND bcv_start < to_date('20-JUL-2005 17:00', 'DD-MON-YYYY HH24:MI') )

Best regards

Maxim Received on Thu Jul 21 2005 - 15:12:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US