Pages

OracleEBSpro is purely for knowledge sharing and learning purpose, with the main focus on Oracle E-Business Suite Product and other related Oracle Technologies.

I'm NOT responsible for any damages in whatever form caused by the usage of the content of this blog.

I share my Oracle knowledge through this blog. All my posts in this blog are based on my experience, reading oracle websites, books, forums and other blogs. I invite people to read and suggest ways to improve this blog.


Wednesday, March 6, 2013

DBMS_UTILITY.GET_TIME


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