当前位置: 代码迷 >> Oracle管理 >> Oracle 帮帮忙解决方法
  详细解决方案

Oracle 帮帮忙解决方法

热度:43   发布时间:2016-04-24 05:56:23.0
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
  相关解决方案