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: Quering a specific TIME not date

Re: Quering a specific TIME not date

From: Brian Peasland <dba_at_nospam.peasland.net>
Date: Mon, 29 Jan 2007 14:04:20 GMT
Message-ID: <JCMv3F.HJ9@igsrsparc2.er.usgs.gov>


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" - Unknown
Received on Mon Jan 29 2007 - 08:04:20 CST

Original text of this message

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