存儲過程,更新滿足條件的數據

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

 

 

發佈了37 篇原創文章 · 獲贊 0 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章