当前位置: 代码迷 >> SQL >> oralce plsql 游标双循环实现 一个表中id的安插
  详细解决方案

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

热度:73   发布时间:2016-05-05 11:57:19.0
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;
  相关解决方案