Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Need help rewriting SQL with TRUNC function

RE: Need help rewriting SQL with TRUNC function

From: Bill Buchan <wbuchan_at_uk.intasys.com>
Date: Thu, 15 Nov 2001 10:26:02 -0800
Message-ID: <F001.003C63EF.20011115092027@fatcity.com>

Wouldn't this introduce a time-of-day dependency on the result?

Instead, how about:

(trunc(sysdate) - erh.arrival_dt)) > 6 AND

(ie. strictly greater than six days ago)

At 08:30 15/11/01 -0800, you wrote:
>Cherie,
>
>Change the clause as follows
>
>orig ==> (trunc(sysdate) - trunc(erh.arrival_dt)) >= 7 AND
>
>new ==> erh.arrival_dt <= sysdate - 7 AND
>
>Hope this helps!
>
>Tom Mercadante
>Oracle Certified Professional
>
>
>-----Original Message-----
>Sent: Thursday, November 15, 2001 10:00 AM
>To: Multiple recipients of list ORACLE-L
>
>
>
>I think that the following statement is keeping this application from using
>an index in my cost-based execution plan. This is an 8.0.4 database so I
>don't have the option of creating a function-based index.
>
>I'm not that great with SQL. Can anyone help me rewrite this statement so
>that I don't need to use the TRUNC function on this column in blue?
>
> (trunc(sysdate) - trunc(erh.arrival_dt)) >= 7 AND
>
>Thanks,
>
>Cherie Machler
>Oracle DBA
>Gelco Information Network
>
>--
>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).
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.com
>--
>Author: Mercadante, Thomas F
> INET: NDATFM_at_labor.state.ny.us
>
>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: Bill Buchan
  INET: wbuchan_at_uk.intasys.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 Thu Nov 15 2001 - 12:26:02 CST

Original text of this message

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