|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
dbms_utility.get_time
It seems like dbms_utility.get_time is not giving me the correct time...?
SET TIMING ON; DECLARE i NUMBER :=0; time1 NUMBER; time2 NUMBER; BEGIN time1:=dbms_utility.get_time; LOOP i:=i+1; DBMS_OUTPUT.PUT_LINE(i); EXIT WHEN i>1000; END LOOP; time2:=dbms_utility.get_time; DBMS_OUTPUT.PUT_LINE(time1); DBMS_OUTPUT.PUT_LINE(time2); DBMS_OUTPUT.PUT_LINE('time elapsed in ms: ' || (time2-time1) /100*1000 ); END; The output of the above script: ... ... 997 998 999 1000 1001 862757 862757 time elapsed in ms: 0 PL/SQL procedure successfully completed. Elapsed: 00:00:11.25 *** It seems like get_time is not returning the correct time... What's happenning? *** THANKS in advance! |
|
#2
|
|||
|
|||
|
well, you're db is just that fast. I believe that the dbms_output is buffered so it doesn't actually slow the loop as you expected. I also got elapsed of 0 on the my fast server.
I tried it with a time based wait loop and it seems to work as expected. example: this waits in the loop for 10 seconds Code:
DECLARE
i NUMBER :=0;
time1 NUMBER;
time2 NUMBER;
waitDate date;
BEGIN
time1:=dbms_utility.get_time;
select sysdate+(1/24/60/60*10) into waitDate from dual;
LOOP
i:=i+1;
EXIT WHEN sysdate >= waitDate;
END LOOP;
time2:=dbms_utility.get_time;
DBMS_OUTPUT.PUT_LINE(time1);
DBMS_OUTPUT.PUT_LINE(time2);
DBMS_OUTPUT.PUT_LINE('time elapsed in ms: ' || (time2-time1) /100*1000 );
END;
Edit: I believe that the elapsed time reported by sql+ includes the time to display the buffered data. Last edited by hedge : October 21st, 2004 at 09:04 AM. |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > dbms_utility.get_time |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|