27,580
社区成员
发帖
与我相关
我的任务
分享
create proc myproc
@a varchar2(10),
@b varchar2(10),
@c varchar2(10)
as
begin
declare @p varchar2(10)
declare @o varchar2(10)
declare @u varchar2(10)
declare test_cur Cursor for
select p,o,u from table wher a=@a and b=@b and c=@c
open test_cur
Fetch Next From test_cur into @p,@o,@u
WHILE @@FETCH_STATUS = 0
begin
update table_other set c=c-1 where p=@p and u=@u
update table set o=o-1 where p=@p and u=@u and o>@o
Fetch Next From test_cur into @p,@o,@u
end
Close test_cur
Deallocate test_cur
end;