代码如下:
create or replace procedure p_class
(sum out number,p_cno in number,ps_date in date,pe_date in date) is
o_num number(2):=0;
a_num number(2):=0;
l_num number(2):=0;
t_cno number(10);
p_date date;
cursor c_attend is select absent,late ,off,cno,c_date from class_attend;
begin
open c_attend;
loop
fetch c_attend into a_num,l_num,o_num,t_cno,p_date;
if t_cno=p_cno and to_char(p_date,'yyyymmdd') between to_char(ps_date,'yyyymmdd') and to_char(pe_date,'yyyymmdd') then sum:=o_num+a_num*5+l_num*2;
exit when c_attend %notfound;
end if;
end loop;
close c_attend;
end;
.
declare
psum number;
p_cno class_attend.cno%type;
s_date date;
e_date date;
begin
p_cno:=1501;
s_date:=to_date('20170314','yyyymmdd');
e_date:=to_date('20170331','yyyymmdd');
p_class(psum,p_cno,s_date,e_date);
update class_attend set sum_evaluation=psum where cno=p_cno;
end;
.
/
过程编译通过了,执行时会卡死,网上找了一一些办法都没有用。本人是菜鸡刚开始接触,希望有大牛可以解惑