扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
具体实践如下:
SQL>create table test (a number(10));
再创建一个存储过程:
create or replace procedure p_test is
i number(10);
begin
i := 0;
while i <= 100000 loop
execute immediate ' insert into test values (' || to_char(i) || ')';
i := i + 1;
end loop;
commit;
end p_test;
先测试没有使用参数绑定的:
运行 p_test 后,用时91.111秒
再创建一个使用参数绑定的:
create or replace procedure p_test is
i number(10);
begin
i := 0;
while i <= 100000 loop
execute immediate ' insert into test values (:a)'
using i;
i := i + 1;
end loop;
commit;
end p_test;
运行 p_test 后,用时55.099秒.
从上面的运行时间可以看出,两者性相差 39.525%,可见,用不用参数绑定在性能上相差是比较大的。
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1416644
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。