Oracle执行Update语句的几种方式


当前第2页 返回上一页

执行merge不会返回影响的行数,最多只能两个表关联。

merge into a
using b 
 on (a.c1=b.c1 and a.c3='2011')
   when matched then
update a.c2=b.c2

四、快速游标更新法(复杂逻辑时,效率很高)

语法:

begin
for cr in (查询语句) loop  --循环
update table_name set ...   --更新语句(根据查询出来的结果集合)
end loop;  --结束循环
end;
begin
    for cur in (select a.rowid  ,b.c2 from  a, b where a.c1=b.c1 and a.c3='2011' )  loop
        UPDATE a  set c2=cur.c2  where rowid=cur.rowid;
    end loop;
end;


打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...