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!

Q: Count concurrent sessions per hours in a specified interval

786074Jul 19 2010 — edited Jul 22 2010
Hi,

I have this table wich contains SESSIONID, CREATEDATE, LASTCHECKDATE, EXPIREDATE, PARTNERID

We need to make a query that would return the number of max concurent session per hours for the interval specified.

For example, for last week, on a per hour bases, or day bases, the top concurent session for each hour or day depending on the report.

can do the number of new session on each hour with this query;

SELECT TO_CHAR(createdate, 'YYYY/MM/DD HH24') ||'h ' start_time, COUNT( SESSIONID ) new_sessions, name || ' {' || partnerid || '}' as Partner
FROM uws
WHERE expiredate IS NOT NULL
and partnerid=25
and TO_CHAR(createdate,'YYYY/MM') = '2010/05'
group by TO_CHAR(createdate, 'YYYY/MM/DD HH24') ||'h ', name || ' {' || partnerid || '}'
ORDER BY 1 DESC;

I think I should use MAX(count(sessionid)) and probably some DECODE when c1 between createdate and lastcheckdate...

This would need to run on sqlplus from a shell script if possible and even chart it on Google Charts.

Any help appreciated, note that I am not an Oracle expert..

Edited by: user11954725 on Jul 19, 2010 5:55 PM
This post has been answered by Frank Kulash on Jul 21 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 19 2010
Added on Jul 19 2010
39 comments
7,400 views