⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 4_2.sql

📁 to become acquainted with a concept &#171 cursor&#187 language of SQL, by the types of cursors, to
💻 SQL
字号:
if (cursor_status('global', 'cursor_1')<>-3)
deallocate  global cursor_1

declare cursor_1 cursor
global
scroll
keyset
for select t2.id_stud as ID
from Student t2
INNER JOIN Mark t4 
ON t2.id_stud=t4.id_stud
INNER JOIN Mark_names t5 
ON t4.id_mark=t5.id_mark
where ball_name<=2

declare @var int, @featch_res int

open cursor_1
while(1=1)
begin
	


	fetch next from cursor_1 into @var
	select st_surname as LName, left(st_name,1) as FName, left(st_pname,1) as Mname, group_name as Groupp 
	from Person t1 
	INNER JOIN Student t2  
	ON t1.id_person=t2.id_person 
	INNER JOIN Grouppa t3  
	ON t2.id_group=t3.id_group 
	where id_stud=@var

set @featch_res=@@FETCH_STATUS	
if (@featch_res=-1)
	break;

end
close cursor_1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -