i need to find the difference between the time in the format hh:mm:ss
select msglog.id,max(msglog.timestamp) enddate,
min(msglog.timestamp) startdate,
en
Date arithmetic in Oracle results in a number expressed in days. So, to convert to hours, you would multiply by 24 and then trunc to get an integral number:
trunc(24 * (enddate - startdate))
To get minutes, convert the days value to minutes and mod() that with 60:
mod(trunc(24 * 60 * (enddate - startdate)), 60)
For seconds, again convert days to seconds and mod() that with 60:
mod(trunc(24 * 60 * 60 * (enddate - startdate)), 60)
Now you can put these together to get the string value you need.