Java Mailing List Archive

http://www.dba.5341.com/

Home » Home (12/2007) » oracle l »

RE: Elapsed Time

Mercadante, Thomas F

2006-05-19

Replies:

Dick,

Have I got a function for you:

Function Second_Convert(in_sec in number)
      return varchar2 is

hrs number;
lmin number;
sec number;

ret_string varchar2(40);
--in_sec number := 3670;

begin

hrs := trunc(in_sec / (60*60));
lmin := trunc((in_sec - (hrs * 60*60))/60);
sec := in_sec - ((hrs * 60 * 60) + (lmin * 60));
ret_string := lpad(hrs,2,'0') || ':' || lpad(lmin,2,'0') || ':' ||
lpad(sec,2,'0');
-- dbms_output.put_line ('hhmiss=' || hrs || ':' || lmin || ':' ||
sec);
return ret_string;

end;

Have fun!

Tom


-----Original Message-----
From: oracle-l-bounce@(protected)
[mailto:oracle-l-bounce@(protected)
Sent: Friday, May 19, 2006 1:12 PM
To: _oracle_L_list
Subject: Elapsed Time

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
--
http://www.freelists.org/webpage/oracle-l


--
http://www.freelists.org/webpage/oracle-l


©2008 dba.5341.com - Jax Systems, LLC, U.S.A.