关于游标的一个问题
declare @ii int
declare c1 cursor local for
select * from rpt_emp_khjl_bal where work_date = @work_date and emp_flag = '1' order by dg_ck_bal desc
for update
set @ii = 0
open c1
fetch next from c1
while @@FETCH_STATUS = 0
begin
set @ii = @ii + 1
update rpt_emp_khjl_bal set dg_ck_sdpm = @ii where current of c1
fetch next from c1
end
close c1
deallocate c1
我要实现的是根据dg_ck_bal 这个字段的降序实现一个排名
可在运行时报错
在 READ ONLY 游标上不能指定 FOR UPDATE。
应该如何解决呢