还是存储过程问题
代码大致思路如下:
open d1;
LOOP
if userCode is null then
FETCH d1
INTO d;
Exit When d1%Notfound;
end if;
select count(*)
into num3
from ec_quantity_list_history t
where t.user_code = d.user_code
and t.electri_quantity_type = 2
and t.electri_fee_month = eletricFeeMonth;--问题是这里,打开游标D1,会有多个user_code。所以这句会有问题。不知道怎么修改,放在哪做判断?
end loop;
close d1;
if num3 = 1 then
INSERT
ELSIF NUM3>1 then
open e1;
LOOP
if userCode is null then
FETCH e1
INTO e;
Exit When e1%Notfound;
end if;
insert
end loop;
close e1;
在线等