sql-server - 另一种光标模板
问题描述
我最近偶然发现了以下游标实现:
open cursor
while 1=1
begin
fetch next
if @@fetch_status <> 0 break
(cursor logic here)
end
这对我来说似乎更清晰,模板代码随处可见,其中包括两个相同的 FETCH:
open cursor
fetch next
while @@fetch_status = 0
begin
(cursor logic here)
fetch next
end
第二次写作有什么好处吗?
解决方案
推荐阅读
- python - 我将数据从 csv 加载到 Python Pandas 并尝试将列设置为行(日期重复)
- java - 如何使用代码从 apk 中提取 SHA/MDA?
- python - 如何将标签添加到子图行和列?
- html - vs code live server 无法得到错误信息
- list - 我想从序言中的现有列表中制作一个过滤列表
- r - 在数据框中添加两个重复列并删除重复项
- php - TCPDF JSON 年假安排
- javascript - 从 .env 文件中获取未定义
- javascript - 无法确定任务 ':app:compileDebugJavaWithJavac' 错误的依赖关系
- reactjs - 一旦产品加载到 redux 商店,UseEffect 不会重新渲染页面