I have the following oracle database table USERS

I have to display the user status begin date&time and end date&time for each status.
From the above example I need to display like STEVE BALE is LOGGED_OUT from 01/08/2013 12:00:00 AM to 01/08/2013 5:04:24.736437 AM
and UNAVAILABLE from 01/08/2013 5:04:24.736437 AM to 01/08/2013 6:04:24.736437 AM,
and AVAILABLE from 01/08/2013 6:04:24.736437 AM to 01/08/2013 7:31:08.591801 AM…
similarly for the given day last record new status, useR STEVE BALE is LOGGED_OUT from 01/08/2013 11:30:50.724405 AM to 01/08/2013 11:59:59 PM..
Thank you for your time.
This is actually pretty easy, because oracle has the
lead()function. Something like:For a string, you can do something like: