Oracle block execution time

Hello Readers,

Long time since my last post. Got busy @ work & cricket wc.

Ever wondered to find the execution time of your cool Oracle proc/function/block. dbms_utility package allows to do this job in an elegant way. Example below:


declare

v_start_time NUMBER;

v_end_time NUMBER;

v_execution_time NUMBER;

begin

v_start_time := dbms_utility.get_time;

-- do PL/SQL

v_end_time := dbms_utility.get_time;

-- get execution time in secs and round to 2 decimal places

v_execution_time := ROUND((v_end_time - v_start_time)/100/60, 2);

dbms_output.put_line ('execution time:  ' || v_execution_time || ' secs');

end

Thanks,

Yours Truly

Advertisements

About Badal Chowdhary

I am a Software Engineer by profession. I have done SCJP and SCWCD certifications. Like working on cutting edge technologies and frameworks. Driven by challenges and fascinated by technology. I love playing and watching sports: Cricket, Ping Pong, Tennis, Badminton, Racket Ball and Gym.
This entry was posted in Oracle and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s