Oracle PL/SQL Tutorial/PL SQL Programming/dbms utility — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 10:08, 26 мая 2010
dbms_utility.get_time
SQL>
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 = :x"
13 using i;
14 fetch l_rc into l_dummy;
15 close l_rc;
16 end loop;
17 dbms_output.put_line
18 ( round( (dbms_utility.get_time-l_start)/100, 2 ) ||
19 " seconds..." );
20 end;
21 /
.63 seconds...
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.70
SQL>
SQL> set timing off
Declare dbms_utility.get_time as a variable default value
SQL> set echo on
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 /
19 hsecs
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL>
SQL> drop table t;
Table dropped.
SQL>
SQL>