首页 > 技术文章 > DM7的SQL批量插入for、while方法

jfqy 2019-10-23 13:46 原文

示例1,for用法:

begin

for i in 1...10000 loop

insert into test values(i,i,'aaa',sysdate);

if i mod 20 = 0 then

commit;

endif;

end loop;

commit;

end;

示例2,while用法:

declare count int default 1;

begin

while  count <= 10000

loop

insert into test values(count);

set count=count+1;

end loop;

commit;

end;

 

推荐阅读