oracle:游标使用样例

前端之家收集整理的这篇文章主要介绍了oracle:游标使用样例前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
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;

execute immediate 'truncate table sys_ward';---执行清空表

---循环2次

while pr_num>0 loop

--游标循环

for v_cinfo in c_departid loop
insert into ……;
end loop;
pr_num :=pr_num-1;
end loop;


commit;

end; 原文链接:https://www.f2er.com/oracle/209740.html

猜你在找的Oracle相关文章