您的位置:首页 > 数据库 > Oracle

oracle 存储过程循环更新

2013-05-25 09:58 183 查看
create or replace procedure chushihua_code11 is

v_code t_bas_sales_department.code%type;

v_fid t_bas_businessdept.fid%type;

cursor cur_track is

select distinct bd.code fcode, bd.fid fid

from (select distinct b.fid, d.code, d.name

from t_bas_businessdept b

join t_bas_sales_department d

on b.fname_l2 = d.name) bd

join t_web_customerinfo_0524 t1

on bd.fid = t1.fservdeptid;

begin

open cur_track;

loop

fetch cur_track

into v_code, v_fid;

exit when cur_track%notfound;

update t_web_customerinfo_0524 t1

set t1.fservdeptid = v_code

where t1.fservdeptid = v_fid;

end loop;

--commit;

end chushihua_code11;

/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: