Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Elapsed Time

RE: Elapsed Time

From: Mercadante, Thomas F \(LABOR\) <Thomas.Mercadante_at_labor.state.ny.us>
Date: Fri, 19 May 2006 13:42:15 -0400
Message-ID: <ABB9D76E187C5146AB5683F5A07336FF681232@EXCNYSM0A1AJ.nysemail.nyenet>


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_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] 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
--

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

--

http://www.freelists.org/webpage/oracle-l Received on Fri May 19 2006 - 12:42:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US