oracle:游标使用样例
发布时间:2020-12-12 15:04:55 所属栏目:百科 来源:网络整理
导读: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
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 loopinsert into ……; end loop; pr_num :=pr_num-1; end loop;
commit; end;(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |