MySQL过程中的语法错误

时间:2015-03-18 15:09:48

标签: mysql stored-procedures syntax-error

我有以下存储过程:

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语法错误

我错过了什么?

0 个答案:

没有答案