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!

Get 1 hour intervals for a date.

user1980Dec 26 2008 — edited Dec 26 2008
Hi,
select sysdate from dual;
This produces
 26-DEC-2008 
How do I get 1 hour intervals for a given date?.

The O/P should be someting like

start from 12/26/2008 12:00:00 AM & end at last 1 hour of the same date( i,e: sysdate - 1 * 60 / 24 / 60 )

i,e

Somthing like
(First)12/26/2008 12:00:00 AM
12/26/2008 01:00:00 AM
12/26/2008 02:00:00 AM
.
.
.
(last) 12/26/2008 03:45:00 PM ( Provided current time is 12/26/2008 04:45:00 PM )
First time interval will be date at 12:00:00 AM
Last time interval will be current time - last 1 hour.

Any ideas how to do this?.

I am actually need this to calculate the avg num of transactions for each hour of a particular date starting with 12:00:00 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 23 2009
Added on Dec 26 2008
7 comments
1,489 views