I'm racking my head, I can't figure out what the problem is. This SQL code does not work on MySQL 5.7
CREATE PROCEDURE sp_create_message (queue_name VARCHAR(50), data TEXT)
DETERMINISTIC
BEGIN
SET @stm = CONCAT('
INSERT INTO queue_', queue_name, '
(data)
VALUES
(?)
');
PREPARE stm FROM @stm;
EXECUTE stm USING data;
DEALLOCATE PREPARE stm;
END //
#1064 - You have an error in the request. Check the documentation for the MySQL version you are using for the correct syntax about " on line 4
i dont now whats the problem.
Rather than use the value directly from an input parameter,the USING clause in the EXECUTE statement only accept user variables. Try modify the code like this:
set @data=data;
EXECUTE stm USING @data;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.