declare
tempId1 department.id%type;
tempId2 department.id%type;
cursor c1 is select id from department where rownum between 100 and 200;
cursor c2 is select id from department;
sharedataId share_data.id%type;
i long :=0;
begin
for c_temp1 in c1 loop
for c_temp2 in c2 loop
select hibernate_sequence.nextval into sharedataId from dual;
insert into share_data values(sharedataId,0,c_temp2.id,c_temp1.id);
dbms_output.put_line('ccc');
commit;
end loop;
end loop;
end;
oralce plsql 游标双循环实现 一个表中id的插入
最新推荐文章于 2022-10-15 17:56:01 发布
本文介绍了一个使用PL/SQL进行批量数据插入的例子。通过两个游标c1和c2,从department表中选择id,并将这些id与其他生成的序列值一起插入到share_data表中。此过程展示了如何在PL/SQL过程中利用循环和游标来高效地操作数据库。
1054

被折叠的 条评论
为什么被折叠?



