declare cur_subject cursor for
select SENDTEL_FLAG
from TB_SUBJECT
--打开并调用游标
open cur_subject
fetch next from cur_subject
into @SENDTEL_FLAG
--循环
while (@@FETCH_STATUS=0)
begin
- declare cur_subjectDetail cursor for --定义一个游标
- select UUID
- from TB_SUBJECTDETAIL
- where Tb_Subject_UUID=@UUID
- --打开并调用游标
- open cur_subjectDetail
- fetch next from cur_subjectDetail
- into @SUBJECTDETAIL_UUID
- --循环
- while (@@FETCH_STATUS=0)--状态等于0说明fetch正常
- begin
- --处理,自己想要的语句--
- --处理,自己想要的语句--
- fetch next from cur_subjectDetail
- into @SUBJECTDETAIL_UUID--取下一个
- end
- --关闭
- close cur_subjectDetail
- --删除游标
- deallocate cur_subjectDetail
fetch next from cur_subject
into @SENDTEL_FLAG
end
--关闭
close cur_subject
--删除游标
deallocate cur_subject