我有以下存储过程:
DELIMITER $$
CREATE PROCEDURE SP_Exclusao_BlocoCeramico (IDBloco BIGINT)
BEGIN
DECLARE ResistenciaID BIGINT DEFAULT 0;
DECLARE curs CURSOR FOR
(
SELECT ResistenciaCompressaoBlocoCeramicoId FROM resistenciacompressaoblococeramico WHERE BlocoCeramicoId = IDBloco
);
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
END;
OPEN curs;
REPEAT
FETCH curs INTO ResistenciaID;
START TRANSACTION;
DELETE FROM relacaoobservacaocompressaoblococeramico WHERE CompressaoBlocoCeramicoId = ResistenciaID;
DELETE FROM resistenciacompressaoblococeramico WHERE BlocoCeramicoId = IDBloco;
DELETE FROM blococeramico WHERE BlocoCeramicoId = IDBloco;
CLOSE curs;
COMMIT;
END
$$
当我运行时,它会返回错误: 1064您的SQL语法错误。
我错过了什么?