DROP PROCEDURE IF exists pro_removeBillRemindByUserId;
create procedure pro_removeBillRemindByUserId(userId int)
begin
declare ts varchar(500);
declare cnt int default 0;
declare f_ID,b int;
DECLARE cur_1 CURSOR FOR select FID from t_bill where FUserId=userId;
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET b = 1;
OPEN cur_1;
REPEAT
FETCH cur_1 INTO f_ID;
delete from t_bill_remind where FBillID=f_ID;
UNTIL b = 1
END REPEAT;
close cur_1;
end;
//调用存储过程
call pro_removeBillRemindByUserId(678);