Mega Code Archive

 
Categories / Oracle PLSQL / System Packages
 

Call dbms_utility get_time twice to time a statement in PL SQL

SQL> SQL> create table t ( x int ); Table created. SQL> SQL> set serveroutput on SQL> SQL> declare   2          l_start number default dbms_utility.get_time;   3  begin   4          for i in 1 .. 1000   5          loop   6                  insert into t values ( 1 );   7          end loop;   8          commit;   9          dbms_output.put_line( dbms_utility.get_time-l_start || ' hsecs' );  10  end;  11  / 21 hsecs PL/SQL procedure successfully completed. SQL> SQL> drop table t; Table dropped. SQL> --