'Cant create procedure in MySql 5.7

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.



Solution 1:[1]

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;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 blabla_bingo