Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Compare time part of date field
"Dave" <davidr212000_at_yahoo.com> wrote in message
news:5e092a4e.0404141053.7671ba26_at_posting.google.com...
| Jens Riedel <JensRie_at_gmx.de> wrote in message
news:<c5jahv$2dqob$1_at_ID-67571.news.uni-berlin.de>...
| > Hello NG,
| >
| > I have a table with a field "STARTDATE" which is a DATE field.
| > Now I'd like to create a SELECT statement which returns all rows where
| > the STARTDATE contains the time 05:59:59, no matter which day.
| >
| > How can I do this the best way?
| >
| > Thanx for help,
| > Jens
|
| SELECT * FROM TABLE WHERE TO_CHAR(STARTDATE, 'HH24:MI:SS') = '05:59:59';
the 'best' way would include performance considerations -- so if this is the
primary search criteria, you will also want to look into creating a
function-based index on the TO_CHAR(STARTDATE...) expression
;-{ mcs Received on Thu Apr 15 2004 - 12:07:02 CDT