sql 游标

时间:2022-02-13 02:11:23

 

更新游标:

DECLARE curSyouBunrui LOCAL FORWARD_ONLY FOR
SELECT A.[オーダーナンバー]
FROM [輸入品生産管理_小分類_移行] A
FOR UPDATE OF A.[オーダー残]

UPDATE [輸入品生産管理_小分類_移行]
SET [オーダー残] = @leaveOrderSuuRyo
WHERE CURRENT OF curSyouBunrui

只读游标:

DECLARE cursor_Data CURSOR FAST_FORWARD FOR

OPEN cursor_Data
FETCH NEXT FROM cursor_Data INTO

WHILE(@@FETCH_STATUS = 0)
BEGIN
FETCH NEXT FROM cursor_Data INTO

END
CLOSE cursor_Data
DEALLOCATE cursor_Data