oracle 中使用游标更新数据

declare cursor cur is select * from test for update ;
    idNum number;
    r test%rowtype;
begin
     idNum:=0;
    open cur;
    loop
        fetch cur  into r;
        exit when cur%notfound;
        idNum:=idNum+1;
        update test set id =idNum where current of cur;
    end loop;
    commit;
    close cur;
end;

ORACLE 多表更新

tba 和tbb 表的id相关联,要将tba的name更新为tbb 的name

UPDATE
     (
      SELECT  A.name aname,B.name bname
      FROM tba A,tbb B WHERE a.id=B.id
     )
     SET aname=bname

相关文章:

  • 2021-09-04
  • 2022-01-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
  • 2021-07-02
猜你喜欢
  • 2021-05-16
  • 2021-06-27
  • 2021-10-11
  • 2022-12-23
  • 2021-10-21
  • 2021-11-25
  • 2021-10-18
相关资源
相似解决方案