Oracle PL/SQL/PL SQL/Timing PL SQL
Timed for loop
SQL>
SQL> -- timed for loop
SQL>
SQL>
SQL> set timing on;
SQL>
SQL> declare
2 some_string varchar2(255);
3 begin
4 for idx in 1 .. 100000 loop
5 some_string := rpad("*",254,"*");
6 end loop;
7 end;
8 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.18
SQL>
SQL> set timing off;
SQL>
SQL>
Timed unconditional loop
SQL> -- timed unconditional loop
SQL>
SQL> set timing on;
SQL>
SQL> declare
2 l_idx pls_integer := 0;
3 l_some_string varchar2(255);
4 begin
5 loop
6 l_idx := l_idx + 1;
7 exit when l_idx = 100000;
8 l_some_string := rpad("*",254,"*");
9 end loop;
10 end;
11 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.28
SQL>
SQL> set timing off;
SQL>
SQL>