Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Re[2]: SQL Tuning - How to avoid TOCHAR function against a date
Bob,
Thanks for your reply. I am testing this afternoon.
Cherie
Robert Eskridge To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> <bryny_at_dfweahs cc: .net> Subject: Re[2]: SQL Tuning - How to avoid TOCHAR function against a Sent by: date root_at_fatcity.c om 04/08/02 02:44 PM Please respond to ORACLE-L
How about something like:
SELECT DATE_KEY
FROM DATE_DIM
WHERE ORACLE_DATE between trunc(:b1) and trunc(:b1)+86399/86400;
It's not the prettiest thing in the world, but it keeps the use of the index on ORACLE_DATE and an adjacent comment that there are 86400 seconds in the day should make it readable enough.
-rje
R> I don't think you can do it.. I mean, you could change it to trunc the R> oracle_date field (that eliminates the minutes) and then do a to_date R> of :b1 but you will still be operating on the oracle_date field.
R> Okay, I HATE to suggest this, but since the table is small:
R> add another field to the table oracle_date_2 as a date field. Update R> the table set oracle_date_2=trunc(oracle_date)
R> add a trigger to fill in oracle_date_2 when you insert a row or update R> the oracle_date column
R> create an index on oracle_date_2 and change the query to use that R> column
R> --- Cherie_Machler_at_gelco.com wrote:
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Robert Eskridge INET: bryny_at_dfweahs.net Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: Cherie_Machler_at_gelco.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Mon Apr 08 2002 - 15:48:25 CDT
![]() |
![]() |