views:

896

answers:

3

I have to get data from Oracle Table in which I have one datefield called lastupdatedDate and I want to get only that rows back in which lastupdatedDate is in last 10 mins of sysdate

for example if in my table I have lastupdateDate as 05/20/09 4:20:44 then I want this row back in my result until from if I run the query in between 05/20/09 4:20:44 to 05/20/09 4:30:44 ,if I run query on 05/20/09 5:31:44 I am not suppose to get this row in my result.

+2  A: 
select sysdate - 10/(24*60) from dual;

See above example to get sysdate minus ten minutes, now just add to your query

curtisk
+2  A: 
select *
from mytable
where lastupdatedDate > sysdate - (10/1440)
RedFilter
+2  A: 

Or slightly more readable:

select *
  from mytable
 where lastupdatedDate > sysdate - interval '10' minute

Regards, Rob.

Rob van Wijk