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

问题描述 投票:0回答:2

对于以下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
mysql flyway
2个回答
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 ;
© www.soinside.com 2019 - 2024. All rights reserved.