`
Supanccy2013
  • 浏览: 215036 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

oralce plsql 游标双循环实现 一个表中id的插入

 
阅读更多
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;
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics