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 -> SYSDATE VS SYSTIMESTAMP

SYSDATE VS SYSTIMESTAMP

From: <setsun_at_gmail.com>
Date: 4 Apr 2006 01:25:23 -0700
Message-ID: <1144139123.735244.169830@e56g2000cwe.googlegroups.com>


Hi,

I am having some trouble querying the database for records that falls between a given date range.

A strip down version of my table is as follows...

TAB_TRADE Trade_ID int, (PK)
Status varchar(10),
Last_mod_date timestamp,
last_mod_user varchar(10)

Now I need to find out all the trade_id's that have been modified within the last 5 days.

So I query

SELECT TRADE_ID, STATUS
FROM TAB_TRADE
WHERE
LAST_MOD_DATE BETWEEN SYSTIMESTAMP-5 AND SYSTIMESTAMP Say I execute this query once every 15 minutes. But this query does not always finds that trades although there are rows satisfying this criteria.

But the following query works

SELECT TRADE_ID, STATUS
FROM TAB_TRADE
WHERE
LAST_MOD_DATE BETWEEN SYSDATE-5 AND SYDATE Can someone shed light on why the inconsistency with SYSTIMESTAMP? Received on Tue Apr 04 2006 - 03:25:23 CDT

Original text of this message

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