Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Elapsed Time
It's just some pretty simple and straightforward math. Try something
like this:
SQL> variable seconds_elapsed number
SQL> exec :seconds_elapsed := 20000;
PL/SQL procedure successfully completed.
SQL> select trunc(:seconds_elapsed/3600) hours, trunc((:seconds_elapsed
- trunc(:seconds_elapsed/3600)*3600)/60) minutes, :seconds_elapsed -
(trunc(:seconds_elapsed/60)*60) seconds from dual
HOURS MINUTES SECONDS
---------- ---------- ----------
5 33 20
SQL> exec :seconds_elapsed := 178
PL/SQL procedure successfully completed.
SQL> /
HOURS MINUTES SECONDS
---------- ---------- ----------
0 2 58
SQL> exec :seconds_elapsed := 0
PL/SQL procedure successfully completed.
SQL> /
HOURS MINUTES SECONDS
---------- ---------- ----------
0 0 0
SQL> exec :seconds_elapsed := 100000
PL/SQL procedure successfully completed.
SQL> /
HOURS MINUTES SECONDS
---------- ---------- ----------
27 46 40
Hope that helps,
-Mark
--
Mark J. Bobak
Senior Oracle Architect
ProQuest Information & Learning
For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled. --Richard P. Feynman, 1918-1988
-----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:39:04 CDT
![]() |
![]() |