Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need help for SQL Query last 5 mins Records.

597724Oct 18 2007 — edited Oct 18 2007
I need the data between the last five minutes from a table which contains Timeid Column and data type is date.

select sysdate,(sysdate-((mod(extract(minutes from systimestamp),5)+5)/24/60)-((extract(second from systimestamp))/24/60/60)) Start_date,
(sysdate-((mod(extract(minutes from systimestamp),5))/24/60)-((extract(second from systimestamp))/24/60/60)) End_Date;

Suppose now the current time is 01:20:00PM then the output should be from

Current Date & Time Start Date & Time End Date & Time
10/18/2007 01:20:00 10/18/2007 01:10:01 10/18/2007 01:15:00

Suppose now the current time is 01:20:01 then the output should be from

Current Date & Time Start Date & Time End Date & Time
10/18/2007 01:20:01 10/18/2007 01:15:01 10/18/2007 01:20:00


The output i am getting where as i need the output shown above.

Current Date & Time Start Date & Time End Date & Time
10/18/2007 01:20:01 10/18/2007 01:14:59 10/18/2007 01:19:59
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 15 2007
Added on Oct 18 2007
10 comments
5,682 views