17,140
社区成员




CREATE OR REPLACE PROCEDURE up_czrk_ryjbxx (tab varchar2 )
as
sfzh varchar2(100);
cunt number;
czrk tab%rowtype; --编译时不通过, 有没有办法绕过去呢?
xhs number default 0;
CURSOR c_czrk IS SELECT * FROM tab;
begin
OPEN c_czrk; --打开游标
LOOP
FETCH c_czrk INTO czrk; --提取游标
exit when c_czrk%notfound;
select 1 into cunt from ry_jbxx where sfzh=czrk.gmsfhm and rownum=1;
if cunt=1 then
--update
select 1 from dual;
else
--insert
select 1 from dual;
end if;
xhs:=xhs+1;
if( mod(xhs,10000)=0) then
commit;
end if;
END LOOP;
commit;
CLOSE c_czrk; --关闭游标
end;