使用MySQL构建带有循环的存储过程时出现的问题
以下过程未更新任何行。语法上有明显的错误吗?我是MySQL新手使用MySQL构建带有循环的存储过程时出现的问题,mysql,stored-procedures,Mysql,Stored Procedures,以下过程未更新任何行。语法上有明显的错误吗?我是MySQL新手 set autocommit = 0; DROP procedure IF EXISTS update_fee; delimiter // CREATE PROCEDURE update_fee() BEGIN DECLARE done INT DEFAULT FALSE; DECLARE t_fee_id int(10); DECLARE t_pubco_id int(10); DECLARE t_auditor_
set autocommit = 0;
DROP procedure IF EXISTS update_fee;
delimiter //
CREATE PROCEDURE update_fee()
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE t_fee_id int(10);
DECLARE t_pubco_id int(10);
DECLARE t_auditor_id int(10);
declare fiscal_period_end_id int(10);
declare t_fiscal_year int(4);
DECLARE t_audit_id int(10);
DECLARE cur1 CURSOR FOR SELECT fee_id, pubco_id, auditor_id, fiscal_period_end_id, fiscal_year
from a_fees;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
OPEN cur1;
read_loop: LOOP
FETCH cur1 INTO t_fee_id, t_pubco_id,
t_auditor_id , fiscal_period_end_id, t_fiscal_year;
IF done THEN
LEAVE read_loop;
END IF;
set t_audit_id = get_audit_id (t_pubco_id,
t_auditor_id,
concat('''', t_fiscal_year, '-',
(select concat(fiscal_period_end_month, '-', fiscal_period_end_day, ''''
)
from a_fiscal_period_end
where t_fiscal_period_end_id = a_fiscal_period_end.fiscal_period_end_id
), ''''
)
);
update a_fees set audit_id = t_audit_id;
END LOOP;
CLOSE cur1;
END;
delimiter ;
设置自动提交=0代码>意味着您必须手动提交更改。使用START TRANSACTION
和COMMIT
或ROLLBACK
我只是在尝试构建过程,但它没有构建。当我尝试调用过程时出现错误:\1305-过程audit\u db1.update\u费用不存在
当您尝试执行上述脚本时会得到什么?