| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> SYSDATE VS SYSTIMESTAMP
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
![]() |
![]() |