RE: Elapsed Time

  • From: "Mercadante, Thomas F \(LABOR\)" <Thomas.Mercadante@xxxxxxxxxxxxxxxxx>
  • To: <DGoulet@xxxxxxxx>, "_oracle_L_list" <oracle-l@xxxxxxxxxxxxx>
  • Date: Fri, 19 May 2006 13:42:15 -0400

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@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Goulet, Dick
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
--
//www.freelists.org/webpage/oracle-l


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


Other related posts: