日期:2014-05-16  浏览次数:20470 次

ORACLE批量更新四种方法比较(转)
原文:http://blog.csdn.net/huanghui22/article/details/1321985
软件环境 Windows 2000 + ORACLE9i?
硬件环境 CPU 1.8G + RAM 512M
?
现在我们有2张表?如下:
T1--大表 10000笔?T1_FK_ID
T2--小表 5000笔?? T2_PK_ID
T1通过表中字段ID与T2的主键ID关联
?
模拟数据如下:
--T25000笔数据
create table T2
as
select rownum id, a.*
?from all_objects a
?where 1=0;
?
-- Create/Recreate primary, unique and foreign key constraints
alter table T2
?add constraint T2_PK_ID primary key (ID);
?
insert /*+ APPEND */ into T2
select rownum id, a.*
????? from all_objects a where rownum<=5000;
?????
--T110000笔数据??????????
create table T1
as
select rownum sid, T2.*
?from T2
?where 1=0;
?
-- Create/Recreate primary, unique and foreign key constraints
alter table T1
?add constraint T1_FK_ID foreign key (ID)
?references t2 (ID);
?
insert /*+ APPEND */ into T1
select rownum sid, T2.*
????? from T2;
?
insert /*+ APPEND */ into T1
select rownum sid, T2.*
????? from T2;
?