ITPub博客

首页 > 数据库 > Oracle > Oracle 批联编命令BULK COLLECT的使用

Oracle 批联编命令BULK COLLECT的使用

原创 Oracle 作者:gss99999 时间:2007-06-29 12:02:19 0 删除 编辑

1.使用批联编可以极大提高效率.

[@more@]

create or replace procedure batch
as
type bulk_type is table of emp_table%rowtype;
ref_bulk bulk_type;
type cursor_type is ref cursor return emp_table%rowtype;
c_bulk cursor_type;

begin
execute immediate 'truncate table emp_table_his';

open c_bulk for select * from emp_table;

loop
fetch c_bulk bulk collect into ref_bulk limit 250000;
forall i in 1..ref_bulk.count
insert into emp_table_his values ref_bulk(i);
commit;
exit when c_bulk%notfound;
end loop;
close c_bulk;
end;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/62484/viewspace-922144/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    14
  • 访问量
    41505