Oracle数据库游标案例讲解与源码(二)

2015-11-21 03:26:59 · 作者: · 浏览: 113
合条件的数据,共'||cur_prdt_catg%rowcount||'条'); exit; end if; end loop; commit; --转换产品类型 open cur_catg; tmpnum:=0; loop fetch cur_catg into v_cid,v_cname; if cur_catg%found then update productinfo_tmp set productinfo_tmp.category=v_cname where category=v_cid; if sql%found then tmpnum:=tmpnum+sql%rowcount; end if; else dbms_output.put_line('产品类型转换完毕,共转换'||tmpnum||'条'); exit; end if; end loop; --产品价格下调 update productinfo_tmp set productinfo_tmp.price=productinfo_tmp.price*0.95 where productinfo_tmp.price>2000; dbms_output.put_line('产品价格更改完毕,共更改'||sql%rowcount||'条'); commit; end;
执行效果图:

\

代码图: