CREATE OR REPLACE PROCEDURE p_updete_gs is --僅供參考
i_jdid varchar(32);
i_ryid varchar(32);
cursor cur is --遊標 給查詢賦值
select c.jdid jdid, t.ryid rybh from t_zcj_rctj t,t_zj_jd c where
t.ryid=c.rybh and t.bgzt<>'3' and c.bgzt<>'3'and c.zjjd<>3
and c.sfsp='3' and sysdate-sspsj2>='5';
BEGIN
for x in cur loop--遊標取值 循環
i_jdid :=x.jdid;
i_ryid:=x.rybh;
--自己的語句
update xxx set xx='3' where x=i_jdid;
update xxxx set xxxxx='3' where xx=i_ryid;
end loop;
--這可以給記錄表插數據
end ;