Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Query: Counting records by Time Interval

Re: SQL Query: Counting records by Time Interval

From: <fitzjarrell_at_cox.net>
Date: Mon, 25 Jun 2007 08:07:20 -0700
Message-ID: <1182784040.583423.307560@c77g2000hse.googlegroups.com>


On Jun 25, 9:45 am, timmy..._at_gmail.com wrote:
> I have a table that tracks Request and Response data coming in and out
> of a system from different systems. Easch transaction originates from
> an external system, comes into the serving system as a Request (RQST),
> is TimeStamped (RQST_TM) and a response is generated (RSPN) and the
> response is TimeStamped (RPSN) and sent to the client system. Some of
> the columns in the table are as follows:
> ECTN CHARACTER 12 NOT NULLABLE
> TRX_TYPE CHARACTER 3 NOT NULLABLE
> RQST VARCHAR 600 NOT NULLABLE
> RQST_TM TIMESTAMP 10 NOT NULLABLE
> RSPN VARCHAR 600 NULLABLE
> RSPN_TM TIMESTAMP 10 NULLABLE
> ORIG_CD CHARACTER 2 NOT NULLABLE
>
> I need to be able to view the number of requests (COUNT) that come in
> by hour intervals (for example between the hours of 8 and 9am, 9 and
> 10 am, 10 and 11am, etc) for a particular day and the peak time period
> the system recieves requests. Could someone help me?
>
> Thanks,
> Tim

The to_char() function can help here:

select ...
from ...
where trunc(somedatecol) = trunc(sysdate) and to_number(medatecol, 'HH24')) between 8 and 9;

You can change the values in the between list to suit you.

David Fitzjarrell Received on Mon Jun 25 2007 - 10:07:20 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US