存储过程游标模板

DECLARE BLBL_CURSOR CURSOR FOR
SELECT ref.RefBillID FROM Table2 ref
WHERE ref.BillID=@Parm_BillID

OPEN BLBL_CURSOR
FETCH NEXT FROM BLBL_CURSOR INTO @sRefBillID
WHILE @@FETCH_STATUS = 0
BEGIN

--exec dbo.SP_Recall @sRefBillID, @rtnCode output, @rtnText output

FETCH NEXT FROM BLBL_CURSOR INTO @sRefBillID
END
CLOSE BLBL_CURSOR
DEALLOCATE BLBL_CURSOR

posted @ 2017-09-09 10:14  金虹巴巴  阅读(165)  评论(0编辑  收藏  举报