Re: Elapsed Time

  • From: "Jared Still" <jkstill@xxxxxxxxx>
  • To: DGoulet@xxxxxxxx
  • Date: Fri, 19 May 2006 11:05:55 -0700

Here's an example to play with:

select
  last_call_et,
  -- idle time
  -- days added to hours
  --( trunc(LAST_CALL_ET/86400) * 24 ) || ':'  ||
  -- days separately
  substr('0'||trunc(LAST_CALL_ET/86400),-2,2)  || ':'  ||
  -- hours
  substr('0'||trunc(mod(LAST_CALL_ET,86400)/3600),-2,2) || ':' ||
  -- minutes
  substr('0'||trunc(mod(mod(LAST_CALL_ET,86400),3600)/60),-2,2) || ':' ||
  --seconds
  substr('0'||mod(mod(mod(LAST_CALL_ET,86400),3600),60),-2,2)  idle_time
from v$session s
order by last_call_et desc



On 5/19/06, Goulet, Dick <DGoulet@xxxxxxxx> wrote:

Folks,

        Before I go off re-inventing the wheel, and yes I still have to
scan AskTom, but here's by "problem".

        I've a developer who has calculated the elapsed time of some
database action, whatever it is, and he wants to display the result to
the user, but not as a pile of seconds.  He wants to convert it into
hours, minutes, and seconds so that the display comes out as a character
string looking like
"x hours y minutes z seconds".  Anyone done that before.

Dick Goulet
Senior Oracle DBA
Oracle Certified DBA
--
//www.freelists.org/webpage/oracle-l





--
Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist

Other related posts: