set timing on : Timing « SQL PLUS Session Environment « Oracle PL/SQL Tutorial






SQL> set echo on
SQL>
SQL> alter system flush shared_pool;

System altered.

SQL>
SQL> set timing on
SQL> declare
  2      type rc is ref cursor;
  3      l_rc rc;
  4      l_dummy all_objects.object_name%type;
  5      l_start number default dbms_utility.get_time;
  6  begin
  7      for i in 1 .. 1000
  8      loop
  9          open l_rc for
 10          'select object_name
 11             from all_objects
 12            where object_id = ' || i;
 13          fetch l_rc into l_dummy;
 14          close l_rc;
 15      end loop;
 16      dbms_output.put_line
 17      ( round( (dbms_utility.get_time-l_start)/100, 2 ) ||
 18        ' seconds...' );
 19  end;
 20  /
47.99 seconds...

PL/SQL procedure successfully completed.

Elapsed: 00:00:48.17
SQL>








29.28.Timing
29.28.1.set timing on
29.28.2.Time the PL/SQL block
29.28.3.TIMING table copying