创建存储过程
create procedure WMSendObj(org in varchar2, dept in varchar2)
as
cursor curss is (select distinct cno
from HR_ARC_DISPATCH_OBJ
where INCLUDEDOWN = 1
and COBJ = cobj);
s_cno varchar2(40);
loopindex Integer;
begin
open curss;
loopindex := 20221103;
loop
fetch curss into s_cno;
exit when curss%notfound;
insert into HR_ARC_DISPATCH_OBJ
values (loopindex, '1', s_cno, dept, '3', '1', '0', null, null, null, null, null, null, 1, 1, 1,
to_date('2021-12-01 15:14:37', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2021-12-01 15:14:37', 'yyyy-mm-dd hh24:mi:ss'),
1, 2);
loopindex := loopindex + 1;
end loop;
commit;
close curss;
end;
调用存储过程
call WMSendObj('123','123')
标签:存储,varchar2,curss,oracle,cno,null,过程,loopindex
From: https://www.cnblogs.com/NewBumblebee/p/16855745.html