发布网友 发布时间:2022-04-23 02:40
共1个回答
热心网友 时间:2023-10-12 02:58
首先是声明游标
course c1 is
select name from table_name where sex='男';
接着就是调用的时候
open c1;
fetch next from xxx into xxx while(XXX)
close c1;
例如下面的列子
CREATE PROCEDURE update_roleNumbrInActCompleter
AS
declare @person_id numeric(18,0)
declare my_cursor cursor for
select name from table_name where sex='男'
open my_cursor
fetch next from my_cursor into @person_id
while (@@fetch_status<>-1)
begin
/*操作的过程语句*/
fetch next from my_cursor into @person_id
end
close my_cursor
deallocate my_cursor
GO
希望对你有帮助~~记得采纳哦~