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

类加,存储过程,大家帮忙看下错在那
create procedure test
(p_b in number ,
 p_mount in number)
as
 l_a number(32);
cursor tes1 is
select a from test
where b=P_b;

begin
  l_b:=0;
 for j in test1 loop
if l_b<p_mount then
  l_b=l_b+j.a;
 else
DBMS_OUTPUT.PUT_LINE(l_b);
end if;
  end loop;
end;

各位帮忙看一下这个存储过程,打???号都不知道错在那。

------解决方案--------------------
l_b=l_b+j.a; 
改成
 l_b:=l_b+j.a;
------解决方案--------------------
游标用错了
前面定义游标
后面不能用for
这样用
open tes1 ;
loop
fetch tes1 into ???;
exit when tes1%notfound;

end loop ;