您的位置:首页 > 其它

存储过程,更新满足条件的数据

2010-04-14 23:27 169 查看
将aaa表中日期为'2010-04-02'的数据的fd_empname更新成与为'2010-04-02'的fd_empname的一样

create or replace procedure updatebydate
is
cursor nw
is select * from aaa where fd_date='2010-04-01';
nw_rec nw%rowtype;
begin

open nw;

loop
fetch nw into nw_rec;
update aaa set fd_empname=nw_rec.fd_empname
where fd_date='2010-04-02' ;

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