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: Date Query Issue

Re: Date Query Issue

From: <shiling_at_math.wayne.edu>
Date: Thu, 10 Jun 1999 15:31:59 GMT
Message-ID: <7jolpf$kqt$1@nnrp1.deja.com>


Yes, you are correct.it is on the wrong side of the where.

SQL> select to_char(mydate,'dd-mon-yy hh24:mi:ss') from t;

TO_CHAR(MYDATE,'DD


10-jun-99 10:52:48
10-jun-99 00:00:00
11-jun-99 00:00:00
09-jun-99 00:00:00

SQL> select * from t
  2 where trunc(to_date(mydate,'dd-mon-yy'))= '10-jun-99';

MYDATE



10-JUN-99
10-JUN-99 SQL> select to_char(mydate,'dd-mon-yy hh24:mi:ss') from t   2 where trunc(to_date(mydate,'dd-mon-yy'))= '10-jun-99';

TO_CHAR(MYDATE,'DD



10-jun-99 10:52:48
10-jun-99 00:00:00

In article <HkP73.114372$pl3.58587_at_newreader.ukcore.bt.net>,   "Kevin A Lewis" <KevinALewis_at_Hotmail.com> wrote:
> I may be wrong but I think the trunc may be on the wrong side of the
where
> clause.
>
> Regards
>
> --
> Kevin A Lewis (BOCM PAULS LTD - Animal Feed Manufacturer - Ipswich
England)
> <KevinALewis_at_HotMail.com>
>
> The views expressed herein by the author of this document
> are not necessarily those of BOCM PAULS Ltd.
> Mark Gumbs <mgumbs_at_nospam.hotmail.com> wrote in message
> news:375fbdef.0_at_145.227.194.253...
> > Try using the trunc command to strip off the time element.
> >
> > eg select ?? from table where date_field =
> > trunc(to_date('15/05/99','DD/MM/YY');
> >
> > M
> >
> > Neil Robinson wrote in message <7joe5k$4bi$3_at_news6.svr.pol.co.uk>...
> > >I have an Access97 front end that uses Oracle 7.3 over odbc. A few
of
> the
> > >queries that I need to produce involve dates or date ranges. When
I try
> to
> > >query on a single date using the criteria
> > >
> > >[field] = #15/05/99#
> > >
> > >the database returns only those records which have a date of
15/5/99 and
> no
> > >time value. If there is a time value within the record it's not
> returned.
> > >ie
> > >
> > >record a: 15/5/99 11:19:04
> > >record b: 15/5/99
> > >record c: 15/5/99
> > >record d: 15/5/99 12:18:33
> > >record e: 15/5/99
> > >
> > >3 records from this set would be returned. This is not a problem
when
> > >querying a date range as the >= and <= operators alleviate it. I
also
> need
> > >to be able to query single dates though and I can't see a simple
way of
> > >doing it, given that the date will be on a user-input form.
> > >
> > >Any ideas?
> > >
> > >Thanks in advance
> > >
> > >--
> > >Neil Robinson
> > >
> > >
> >
> >
>
>

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Thu Jun 10 1999 - 10:31:59 CDT

Original text of this message

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