计算程序运行的时间(ms)

declare
    type rc is ref cursor;
    l_rc rc;
    l_dummy all_objects.object_name%type;
    l_start number default dbms_utility.get_time;
begin
    for  I  in 1 .. 1000
    loop
        open l_rc for
          'select object_name  from all_objects '||

'where object_id = ' || i;
        fetch l_rc into l_dummy;
        close l_rc;
    end loop;
    dbms_output.put_line
    ( round( (dbms_utility.get_time-l_start)/100, 2 ) ||
      ' seconds...' );
end; 

你可能感兴趣的:(计算程序运行的时间(ms))