oracle使用游标循环更新某个字段值

declare 
  he doctor%rowtype;
  cursor mycursor(d_password string) is select * from doctor where d_password = d_password for update;
begin
  open mycursor('000000');
  while(true) loop
     fetch mycursor into he; 
     exit when mycursor%notfound;
     update doctor set d_password = '123456' where current of mycursor;
  end loop;
end;

(doctor为表名,d_password为列名)

你可能感兴趣的:(数据库)