INSERT INTO TB(COL1,COL2,,,,) SELECT 主键+1,..... FROM TB WHERE 主键 IN(SELECT MAX(主键) FROM TB)
先插入主键,让其它字段空记录: declare count number(10); begin count := 0; while count < 1000 loop insert into tableA(id) values (count); count := count + 1; end loop; commit; end;第二步,统统更新: update talbeA set col1 = 'aaa', col2 = 'bbb' ...............; commit;
建个临时表,表结构一样 test(id,name) create global temporary t_table as select * from test; insert into t_table select * from test where id=1; update t_table set id=id+1; insert into test select * from t_table; drop table t_table;
SELECT 主键+1,.....
FROM TB
WHERE 主键 IN(SELECT MAX(主键) FROM TB)
declare
count number(10);
begin
count := 0;
while count < 1000 loop
insert into tableA(id) values (count);
count := count + 1;
end loop;
commit;
end;第二步,统统更新:
update talbeA set col1 = 'aaa', col2 = 'bbb' ...............;
commit;
test(id,name)
create global temporary t_table as select * from test;
insert into t_table select * from test where id=1;
update t_table set id=id+1;
insert into test select * from t_table;
drop table t_table;