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 function that leaves only the time?

Re: Date function that leaves only the time?

From: Paul Dixon <root_at_127.0.0.1>
Date: Wed, 17 Dec 2003 14:32:08 +0000 (UTC)
Message-ID: <brppd8$6g7$1@visp.bt.co.uk>

"Jeff Smith" <jsmit234 at ford dot com> wrote in message news:brpi1f$ebs5_at_eccws12.dearborn.ford.com...
> SELECT DATE_COL
> FROM TABLE
> WHERE TO_CHAR( date_col, 'SSSSS') BETWEEN 61200 AND 64000
>
> or
>
> SELECT DATE_COL
> FROM TABLE
> WHERE TO_NUMBER(TO_CHAR( date_col, 'SSSSS')) BETWEEN ((17*60)*60) AND
> ((18*60)*60)
>
> I think to_number will make it run faster...

Jeff,

thanks for the suggestions. Don't know whether either will run any faster than my current method though as they both involve Date to Character to Number conversions, whereas my method uses just a Date to Number conversion (albeit two of them) ?

I'll certainly try it out next time I need to select records within a time range.

Paul Dixon

> "Paul Dixon" <root_at_127.0.0.1> wrote in message
> news:brpb6p$mvf$1_at_visp.bt.co.uk...
> >
> > <Mark.Wright_at_bristol.ac.uk> wrote in message
news:HpL8Kq.KG1_at_bath.ac.uk...
> > > I'm looking for a function that is essectially the opposite of
> > > TRUNC(). I.e., I have full date-time fields, but I only care about the
> > > time. If I select TRUNC(column) I can get only records on a date, but
I
> > > want only records in a time-range (e.g. 5pm-6pm), regardless of date.
> How
> > > can I do this easily?
> > > Cheers,
> >
> > Mark,
> >
> > I would do this by using following selection criteria :-
> >
> > WHERE date_column - TRUNC(date_coulmn) BETWEEN 17/24 and 18/24
> >
> > but would be very interested in finding any better ways.
> >
> >
> > Paul Dixon
> >
> >
>
>
Received on Wed Dec 17 2003 - 08:32:08 CST

Original text of this message

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