How can I fix MySQL error #1064?

后端 未结 2 1251
难免孤独
难免孤独 2020-11-21 13:10

When issuing a command to MySQL, I\'m getting error #1064 \"syntax error\".

  1. What does it mean?

  2. How can I fix it?

2条回答
  •  执念已碎
    2020-11-21 14:03

    For my case, I was trying to execute procedure code in MySQL, and due to some issue with server in which Server can't figure out where to end the statement I was getting Error Code 1064. So I wrapped the procedure with custom DELIMITER and it worked fine.

    For example, Before it was:

    DROP PROCEDURE IF EXISTS getStats;
    CREATE PROCEDURE `getStats` (param_id INT, param_offset INT, param_startDate datetime, param_endDate datetime)
    BEGIN
        /*Procedure Code Here*/
    END;
    

    After putting DELIMITER it was like this:

    DROP PROCEDURE IF EXISTS getStats;
    DELIMITER $$
    CREATE PROCEDURE `getStats` (param_id INT, param_offset INT, param_startDate datetime, param_endDate datetime)
    BEGIN
        /*Procedure Code Here*/
    END;
    $$
    DELIMITER ;
    

提交回复
热议问题