create or replace procedure pk_sysward
is
--利用游标 循环插入各个病区
cursor c_departid is select * from sys_department;
v_cinfo c_departid%rowtype;
pr_wardid number(3);
pr_num number(2);
begin
pr_wardid :=100;
pr_num :=2;
@H_301_12@ execute immediate 'truncate table sys_ward';---执行清空表
@H_301_12@ ---循环2次
@H_301_12@ while pr_num>0 loop
@H_301_12@ --游标循环 for v_cinfo in c_departid loop
insert into ……;
end loop;
pr_num :=pr_num-1;
end loop;
@H_301_12@
@H_301_12@ commit; end; 原文链接:https://www.f2er.com/oracle/209740.html