Flyway产生MySQL语法错误,而原始脚本则没有

时间:2015-08-04 17:10:39

标签: mysql flyway

对于以下MySql脚本,Flyway会产生MySQL语法错误,而直接在Navicat中运行脚本可以正常工作。谁能告诉我为什么会这样?

CREATE PROCEDURE RegressionTest_Genealogy (OUT Success TINYINT)
BEGIN  
    DECLARE MetricVerification TINYINT;
    SET Success = 0;

    SELECT COUNT(MERTRICID) INTO MetricVerification FROM metrics_temp WHERE lft = 0 OR rgt = 0;

    IF MetricVerification = 0 THEN
        SET Success = 1;
    END IF;
END

2 个答案:

答案 0 :(得分:1)

您可能需要先发出分隔符更改才能使其正常工作,因为默认情况下分隔符为;这包含在您的程序正文中。

答案 1 :(得分:0)

试试这个

DELIMITER //
CREATE PROCEDURE RegressionTest_Genealogy (OUT Success TINYINT)
BEGIN  
DECLARE MetricVerification TINYINT;

SET Success = 0;

SELECT COUNT(MERTRICID) INTO MetricVerification FROM metrics_temp WHERE lft = 0 OR rgt = 0;

IF MetricVerification = 0 THEN
    SET Success = 1;
END IF;
END //
DELIMITER ;