I am running the following SQL query:
Executing (default): DROP PROCEDURE IF EXISTS x;
DELIMITER $$
CREATE PROCEDURE x()
BEGIN
# do something
END $$
DELIMITER; $$
Like so:
sequelize.query(query, {
type: sequelize.QueryTypes.SELECT
});
But I get this error (even though it works just fine, if I use any other SQL client):
SequelizeDatabaseError: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER $$
CREATE PROCEDURE x()
BEGIN
I already added multipleStatements = true to my connection config, but it does not do anything.
Update
I ended up using RAW instead, like so:
sequelize.query(query, {
type: sequelize.QueryTypes.RAW
});
DELIMITER is not part of MySQL server, it's part of the MySQL command line client. This feature is not available in the driver.
Source: https://github.com/mysqljs/mysql/issues/280#issuecomment-8081626
Your error is actually in the last line. Take out the $$ after DELIMITER;
The statement: DELIMITER; resets the delimiter to ; the $$ after that confuses the syntax analyzer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With