Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Quering a specific TIME not date
Gaz wrote:
> I dont know if its possible as ive tried everything but cant get it to
> work...
>
> My data is stored as a date so its for example 23/03/2007 10:00:00
>
> How would i write a SQL statement to find me all records that have
> 10:00 in them and ignore the date?
>
> Ive tried "Where to_date(fieldname,'24H:MI') >=to_date('10:00',24H:MI')
> but it doesnt work
>
>
> HELP ......
>
Do you want everything that happened in the hour of 10:00? If so, then something like the following:
TO_CHAR(fieldname,'HH24') = '10'
And I think you need "TO_CHAR" since "fieldname" is a DATE datatype (if I read your description right). The second conversion is not necessary as it is already a character string.
HTH,
Brian
-- =================================================================== Brian Peasland dba_at_nospam.peasland.net http://www.peasland.net Remove the "nospam." from the email address to email me. "I can give it to you cheap, quick, and good. Now pick two out of the three" - UnknownReceived on Mon Jan 29 2007 - 08:04:20 CST
![]() |
![]() |