对于以下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
您可能需要首先发出分隔符更改才能使其正常工作,因为默认情况下分隔符是;它包含在您的程序正文中。
试试这个
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 ;