Bin变数在PL/SQL区进行工作,在K.表中也是如此。
可以通过在休息室做简单发言来测试这一点,然后看v$sesstat
。
建立一个简单的表格,用于插入和删除。 2. 初步 par计。
create table test1(a number);
--Flush the pool, or else this test won t be repeatable.
alter system flush shared_pool;
select value, name
from v$sesstat natural join v$statname
where sid = sys_context( userenv , sid )
and name in ( parse count (total) , parse count (hard) );
47 parse count (total)
5 parse count (hard)
这正是我们所期望的:
begin
for i in 1 .. 10000 loop
execute immediate insert into test1 values( ||i|| ) ;
end loop;
commit;
end;
/
select value, name
from v$sesstat natural join v$statname
where sid = sys_context( userenv , sid )
and name in ( parse count (total) , parse count (hard) );
10072 parse count (total)
10007 parse count (hard)
具有变量的PL/SQL区并非总是硬木。 请注意, par计是累积的,在此仅略有增加。
begin
for i in 1 .. 10000 loop
execute immediate
begin
delete from test1 where a = :i;
end;
using i;
end loop;
commit;
end;
/
select value, name
from v$sesstat natural join v$statname
where sid = sys_context( userenv , sid )
and name in ( parse count (total) , parse count (hard) );
10106 parse count (total)
10019 parse count (hard)