Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: how to get the entries from the last 2 hours?
Angela wrote:
>
> hi all
>
> does somebody know how i cant get the entries from a database which
> were added in the last 2 hours?? i tried it like this:
> select * from logdata where timestamp > (SYSDATE - TO_DATE('2',
> 'HH24'))
>
> i also tried id without '' but it isn't working at all :((
>
> thanks a lot
Try
select *
from logdata
where timestamp > ( sysdate - 2 / 24 )
When you subtract 1 from a date then it will be decreased by 1 day. When subtracting 1/24 then it is decreasing by 1 hour...you get the idea?
BTW.: TO_DATE('2', 'HH24') produces a date on the 1st day of the current month...
Regards, Stephan Received on Tue Dec 11 2001 - 09:41:16 CST
![]() |
![]() |