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!

Date difference

user2587297Mar 7 2017 — edited Mar 8 2017

Hello All,

I am looking to calculate Time between the 'User logged in' and 'User timeout' STATUS column for each SESSION ID.

Table Structure and Values defined below. 

Table Structure:

Create Table Session

(SESSION ID VARCHAR2(100 BYTE),

DATETIME DATE,

STATUS CLOB)

TABLE VALUES:

SESSION ID    DATETIME                              STATUS

12345               09/02/2016 11:20:51 AM        User logged in

12345               09/02/2016 11:25:12 AM        Session initiated

12345               09/03/2016 1:20: 51 PM         User timeout

12345               09/03/2016 1:45: 11 PM         User idle

Output:

SESSION ID  TOTALHOURS

12345             26

Thanks for you help in advance.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 5 2017
Added on Mar 7 2017
21 comments
468 views