日期:2014-05-18  浏览次数:20543 次

求助给分析一下最后@@cursor_rows为什么是-1呀?
use XSCJ
select @@cursor_rows
declare student_cursor cursor for
select 姓名 from XS
open student_cursor
fetch next from student_cursor
select @@cursor_rows
close student_cursor
deallocate student_cursor



结果是"无列名 0" "姓名 王林" "无列名 -1" 

"fetch next from student_cursor" 不是取出第一条记录吗?
最后@@cursor_rows怎么会是-1呀,
-1不是表示游标已经到了最后一行记录的下一行吗?
高手帮忙给解释一下,谢谢


------解决方案--------------------
'fetch first from student_cursor'是取第一条记录的
------解决方案--------------------
-1不是表示游标已经到了最后一行记录的下一行吗?这是@@fetch_status的意思
@@CURSOR_ROWS表示的是游标的填充方式及行数,具体看帮助
------解决方案--------------------
-1 

游标为动态。因为动态游标可反映所有更改,所以符合游标的行数不断变化。因而永远不能确定地说所有符合条件的行均已检索到。