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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Trouble selecting dates

Re: Trouble selecting dates

From: Bill Watson <bill.watson_at_blueyonder.co.uk>
Date: Sun, 07 Apr 2002 20:56:49 GMT
Message-ID: <lo2s8.2010$p4.308087@news-binary.blueyonder.co.uk>


The request_date in the absence_history table may have a milli-second component and unless this is 0 then your SELECT statement will not return any rows. I think that you will have to try something like

select request_date
from new_absence_history
where trunc( request_date, 'YYYY-MM-DD HH:MI:SS') = to_date('2002-03-13 03:19:39','YYYY-MM-DD HH:MI:SS'); I would also suggest that if you are only interested in the date (and not the time) component, then maybe your date format mask should be 'YYYY-MM-DD'. Regards,

Bill

"Nigel Reed" <nelgin_at_nortelnutworks.com> wrote in message news:34kraugstdroe4r9qpmp78k041sobrrpkr_at_4ax.com...
> I've been dumped a project and not really an Oracle type, so I hope
> someone can help me with this issue.
>
> SQL> ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH:MI:SS';
>
> Session altered.
>
> SQL> select request_date from new_absencehistory where
> absence_type='PH';
>
> REQUEST_DATE
> -------------------
> 2002-03-13 03:12:55
> 2002-03-13 03:19:39
>
> SQL> select request_date from new_absencehistory where
> request_date=to_date('2002-03-13 03:19:39','YYYY-MM-DD HH:MI:SS');
>
> no rows selected
>
> Now my question is, why can't I select on this date?
>
> Any advice would be appreciated cos I'm stuck.
>
> Regards
> Nigel
>
> ** When replying via email please change the nut to net **
> --
> Nigel Reed
> DES Engineering & Infrastructure
> Nortel Networks, 2201 Lakeside Blvd, Richardson, TX 75082
> ESN 444 8859 External 972 684 8859 Mailstop: 992/02/A30
> We will never give Bill Clinton the opportunity to be the President of the
United States.
> - Vice President Dan Quayle (9/19/92)
> * Any opinion expressed in this message is mine and not that of Nortel
Networks * Received on Sun Apr 07 2002 - 15:56:49 CDT

Original text of this message

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