Use dbms_utility to time : dbms_utility « System Packages « Oracle PL / SQL






Use dbms_utility to time

   
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 'select object_name from all_objects where object_id = ' || i;
 10          fetch l_rc into l_dummy;
 11          close l_rc;
 12      end loop;
 13      dbms_output.put_line( round( (dbms_utility.get_time-l_start)/100, 2 ) || ' seconds...' );
 14  end;
 15  /
37.76 seconds...

PL/SQL procedure successfully completed.

Elapsed: 00:00:38.10
SQL> set timing off
SQL>
SQL> --

   
    
  








Related examples in the same category

1.This script demonstrates DBMS_UTILITY.NAME_TOKENIZE.
2.time to commit
3.dbms_utility.get_parameter_value
4.Call dbms_utility.get_time twice to time a statement in PL SQL
5.round dbms_utility.get_time
6.Assign dbms_utility.get_time to integer variable
7.Use dbms_utility.get_time to do performace check
8.dbms_utility.format_error_stack
9.Timing Per Thousand Records Processed (in secs)
10.Timing Package function call
11.use DBMS_UTILITY.FORMAT_ERROR_STACK in a SERVERERROR trigger.
12.DBMS_UTILITY.analyze_schema
13.demonstrates the use of DBMS_UTILITY.TABLE_TO_COMMA and DBMS_UTILITY.COMMA_TO_TABLE.
14.Performace difference between simple parameter and collection parameter