Home » SQL & PL/SQL » SQL & PL/SQL » How to fetch time interval
How to fetch time interval [message #394755] Mon, 30 March 2009 03:32 Go to next message
smittal17
Messages: 7
Registered: March 2009
Junior Member
Hi ,

I an having a schema something like this

Service Timestamp Severity
Mar5,2009,5:50 PM Critical
Mar5,2009,5:55 PM Normal
Mar5,2009,6:50 PM Critical
Mar5,2009,6:51 PM Normal
Mar5,2009,7:50 PM Critical
Mar5,2009,7:52 PM Normal


Now I want in day for how many times and for how much duration service reamins in critical state i.e I want Normal timestamp- Critical time stamp

downtime1=Mar5,2009,5:55 PM-Mar5,2009,5:50 PM
downtime2=Mar5,2009,6:51 PM-Mar5,2009,6:50 PM
downtime3=Mar5,2009,7:52 PM-Mar5,2009,7:50 PM.

My problem is how should I get the other time stamps of critical after set to noraml state and similarily other normal one and also how many times it is happnening?

please help.

Re: How to fetch time interval [message #394765 is a reply to message #394755] Mon, 30 March 2009 04:12 Go to previous messageGo to next message
rajy_salim
Messages: 204
Registered: January 2008
Location: Beirut - Lebanon
Senior Member
Welcome to the Forum.
Please read The Froum Guidelines, and how to format your post to help us provide good and clear solutions.
Please post a Test Case.

Rajy
Re: How to fetch time interval [message #395015 is a reply to message #394755] Tue, 31 March 2009 01:27 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Have a look at LAG/LEAD functions.

Regards
Michel
Re: How to fetch time interval [message #395024 is a reply to message #395015] Tue, 31 March 2009 02:12 Go to previous message
smittal17
Messages: 7
Registered: March 2009
Junior Member
Ya Michel,

Got it thanks a lot Smile
Previous Topic: query for database
Next Topic: Execute .lib at in Oracle
Goto Forum:
  


Current Time: Wed Dec 07 14:55:57 CST 2016

Total time taken to generate the page: 0.08545 seconds