This function returns the number of 100ths of seconds that have elapsed from an arbitrary time.
Syntax
DBMS_UTILITY.GET_TIME RETURN NUMBER;
Usage Notes
You should not use GET_TIME to establish the current time, but only to calculate the elapsed time between two events. Without GET_TIME, Oracle functions can only record and provide elapsed time in second intervals, which is a very coarse granularity in today's world of computing. With GET_TIME, you can get a much finer understanding of the processing times of lines in your program.
Example
The following example calculates the number of 100ths of elapsed seconds since the calc_totals procedure was executed:
DECLARE time_before BINARY_INTEGER; time_after BINARY_INTEGER; BEGIN time_before := DBMS_UTILITY.GET_TIME; calc_totals; time_after := DBMS_UTILITY.GET_TIME; DBMS_OUTPUT.PUT_LINE (time_after - time_before); END;
Notice that in our anonymous block we had to declare two local variables, make our calls to GET_TIME, and then compute the difference. We will probably need to perform those actions over and over again in our programs. You might even want to perform timings that cross product lines (e.g., start a timing in a form and then check elapsed time from inside a report module).
Syntax diagrams and parameter descriptions adapted from Oracle, Inc. documentation.
No comments:
Post a Comment