Re: How extract time values from date fields?

From: KB <kb_at_smartt.com>
Date: Sat, 16 Jan 1999 01:31:29 GMT
Message-ID: <35c8f582.3469459549_at_news.smartt.com>


TRUNC() will not work because it removes the most precise bits.

You can use

   select ... from ...
   where to_date(to_char(time0,'HH24:MI),'HH24:MI) >= ...

to ignore the year,month, and day ot time0, time1 and time2. The type conversion should have negligible CPU overhead, but will preclude the use of any indexes on the 3 date fields.

On Fri, 15 Jan 1999 12:21:41 +0000, Maarten Meijer <M.Meijer_at_accu.uu.nl> wrote:

>Hello Oracle programmers,
>Could anyone solve this little problem? In a PL/SQL program,
>I'm trying to
>
>select ... from ...
>where time0 between time1 and time2
>
>time0, time1 and time2 are of type DATE, but I'm only interested
>in the time portion of these dates!
>Since time0 is being input by a user, the date portion of time0
>is set to the first of the current month and year, while time1
>and time2 can have other month and year values.
>So how do I ignore these day, month and year values??
>
>Thanks!
>--
>Maarten Meijer (030)2531660/2805001 http://www.accu.nl/~mmeijer
> ACCU (Academisch Computercentrum Utrecht) fax (030)2531633
> Budapestlaan 6, P.O.Box 80011, 3508 TA Utrecht NL
Received on Sat Jan 16 1999 - 02:31:29 CET

Original text of this message