游标问题

[复制链接]
查看11 | 回复1 | 2014-4-25 10:17:07 | 显示全部楼层 |阅读模式
大家好,今天练习写了下面的游标,但是编译的时候报错了,麻烦给指点下,谢谢
create or replace procedure cursortest1
is
idnamevarchar2(14);
ilocvarchar2(13);
cursor cselectdept
is
select dname,loc
from scott.dept;
begin
open cselectdept;
loop
fetch cselectdept
into idname,iloc;
exit when cursortest1%notfound;
dbms_output.put_line(idname||iloc);
end loop;
close cselectdept;
end;
/

回复

使用道具 举报

千问 | 2014-4-25 10:17:07 | 显示全部楼层
我也刚学的菜鸟一个,不知道理解对不对,你select出来的select dname,locfrom scott.dept结果是一条记录吗?如果不是一条记录就不能用fetch into,请各位大神给个正确的答案。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行