我创建了一个游标,然后我要更新游标里面的记录,怎么弄?有没有什么格式?大侠们快来帮忙!

解决方案 »

  1.   

    declare
      Cursor 游标名 is select 字段1,字段2 from 表名 for update;
      v_字段1 varchar(10);
      v_字段2 varchar(10);
    begin
        open 游标名;
        loop
            fetch 游标名 into v_字段1,v_字段1;
            exit when 游标名%notfound;
            update 表名  set 字段='xxx' where current of 游标名;
        end loop;
        close 游标名;
    end;