1

For the following MySql script Flyway produces a MySQL syntax error while running the script directly in something like Navicat works fine. Can anyone tell me why that is?

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
1
  • 1
    Don't forget to share your error. Commented Aug 4, 2015 at 17:45

2 Answers 2

2

You probably need to issue a delimiter change first to make this work, as per default the delimiter is ; which is contained in your procedure body.

Sign up to request clarification or add additional context in comments.

Comments

2

Try this

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 ;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.