1. 程式人生 > >存儲過程遊標模板

存儲過程遊標模板

etc oca -- code arm tput dbo 存儲過程 ref

DECLARE BLBL_CURSOR CURSOR FOR
SELECT ref.RefBillID FROM Table2 ref
WHERE [email protected]_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

存儲過程遊標模板