DBMS_UTILITY.GET_TIME is a function available in Oracle Database to get time in millisecond. You need to divide it by 100 to get time in seconds.
Below is the syntax,
DBMS_UTILITY.GET_TIME RETURN NUMBER;
The return type is number and in some cases, it is negative as well.
DBMS_UTILITY.GET_TIME Examples
Now, let’s understand the working of dbms_utility.get_time function with some examples. This is a function, so you can simply write below SQL query to get the time.
SELECT dbms_utility.get_time FROM DUAL;
In PL/SQL, define a local variable and use the above query using the into clause.
SELECT dbms_utility.get_time INTO l_time FROM DUAL;
Alternatively, you can also call the function in the assignment operator as shown below.
l_time := dbms_utility.get_time;
How to use dbms_utility.get_time to calculate the elapsed time for a procedure?
Call this function at the beginning of the procedure and store returned time in a variable. Again call the function when the procedure completes. Now, just subtract the time to get the elapsed time for that procedure.
There is a good discussion happening on asktom.oracle.com about this utility. I would recommend reading it.