Help on calculate time difference
125944Apr 24 2012 — edited Apr 24 2012Hi all
I have a problem to calculate time difference related to existence of particular job in many rows
Here the table
create table ttimb
(id varchar2(5) not null,
ttype varchar2(1) not null,
ttime date not null
)
Insert into ttimb
values('2','E',SYSDATE)
-- after a while
insert into ttimb
values('2','U',SYSDATE)
-- after a while
insert into ttimb
values('1','E',SYSDATE)
-- after a while
insert into ttimb
values('1','U',SYSDATE)
The type 'E' is equal a start time of the job while ttype = 'U' is the end of the job
I would obtain a similar like
1 24/04/2012 34 seconds (difference in time between id 1 ttype U (13:22:07) and ttype E (13:21:33)
1 24/04/2012 38 seconds (difference in time between id 1 ttype U (13:23:19) and ttype E (13:22:41)
2 24/04/2012 29 seconds (difference in time between id 2 ttype U (13:23:56) and ttype E (13:23:27)
for each id the time consuming of the job in the day
Thanks in advance