日期:2014-05-17  浏览次数:20793 次

Oracle 帮帮忙
编写块,要求用游标将下列‘年龄’数据逐条放入变量V_AGE中,v_age为NUMBer型 姓名 年龄 张三 18 李四 21 王五 20

------解决方案--------------------
自问自答?
declare 
cursor c is 
select sage from student; 
v_age number(2); 
begin 
open c; 
 loop 
--执行你要做的事情 可以取道v_age 
fetch c into v_age ;
--加上 
exit when c%notfound;

end loop; 
close c; 
end;


------解决方案--------------------
把fetch c into v_age ; 放在第一個LOOP的下面
然后
--执行你要做的事情 可以取道v_age