您的位置:首页 > 数据库 > Oracle

oracle游标的使用

2013-04-15 21:47 429 查看
--使用游标

declare
stu_name varchar2(20);
stu_score integer;
--定义游标
cursor cursor_student is
select stuname,stuscore from student where stuid = 88;
begin
--打开游标
open cursor_student;
--提取游标数据
fetch cursor_student into stu_name,stu_score;

if cursor_student%isopen then
dbms_output.put_line('游标已经打开!');
end if;
if cursor_student%found then
dbms_output.put_line('游标中包含数据!');
end if;
if cursor_student%notfound then
dbms_output.put_line('游标中不包含数据!');
end if;
dbms_output.put_line('游标的行数:'||cursor_student%rowcount);
--关闭游标
close cursor_student;
end;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: