亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

關于游標的問題

關于游標的問題

蕪湖不蕪 2018-07-30 09:06:06
declare BRItemCusror cursor for select BRItemID from RechageItem where State=0 and AccountID=@AccountId;open BRItemCusrorfetch next from BRItemCusror into @BRItemID;為什么@@Fetch_Status = -1?  不明白出錯在哪  明明定義游標的SQL查詢結果是有記錄的。
查看完整描述

2 回答

?
POPMUISE

TA貢獻1765條經驗 獲得超5個贊

游標我的理解就是在SQL中循環,循環肯定是由條件的,修改成下面試試看:

declare BRItemCusror cursor for select BRItemID from RechageItem where State=0 and AccountID=@AccountId;open BRItemCusrorwhile    @@fetch_status=0  --結束的條件 
     begin   
         fetch next from BRItemCusror into @BRItemID;     endclose   BRItemCusror--關閉游標
 deallocate   BRItemCusror

另外看一下

select BRItemID from RechageItem where State=0 and AccountID=@AccountId;

這里面有東西嗎?


查看完整回答
反對 回復 2018-08-01
?
達令說

TA貢獻1821條經驗 獲得超6個贊

游標一般用一樓那個結構寫的。

查看完整回答
反對 回復 2018-08-01
  • 2 回答
  • 0 關注
  • 791 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號