在运行程序的时候,常常使用dbms_utility.get_time,取2个点的时间,并相减,来获取运行时间。
eg:
declare i number;
j number;
begin
i:=dbms_utility.get_time;
dbms_lock.sleep(1.51);
j:=dbms_utility.get_time;
dbms_output.put_line(j-i);
end;
那么dbms_utility.get_time究竟表示什么含义呢?查了下官方文档,同时google了下,单个该函数没有什么具体含义,主要是2个值相减取差值。
官方文档参考:
GET_TIME Function
This function determines the current time in 100th's of a second. This subprogram is primarily used for determining elapsed time. The subprogram is called twice – at the beginning and end of some process – and then the first (earlier) number is subtracted from the second (later) number to determine the time elapsed.
Syntax
DBMS_UTILITY.GET_TIME
RETURN NUMBER;
Return Values
Time is the number of 100th's of a second from the point in time at which the subprogram is invoked.
Usage Notes
Numbers are returned in the range -2147483648 to 2147483647 depending on platform. and machine, and your application must take the sign of the number into account in determining the interval. For instance, in the case of two negative numbers, application logic must allow that the first (earlier) number will be larger than the second (later) number which is closer to zero. By the same token, your application should also allow that the first (earlier) number be negative and the second (later) number be positive.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23700752/viewspace-735966/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23700752/viewspace-735966/
本文详细解析了dbms_utility.get_time函数的含义、返回值和使用注意事项,通过实例展示了如何利用该函数计算程序运行时间。重点强调了其在性能分析和监控中的应用。

739

被折叠的 条评论
为什么被折叠?



