將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;