I’m trying to create a stored procedure in phpmyadmin but when I try to create a second one, I get the error
#1327 – Undeclared variable.
This works fine:
BEGIN
DECLARE id_pro INT(9);
SELECT user_product_id INTO id_pro FROM usuario;
END
But if I want to add another variable, I get the error above:
BEGIN
DECLARE id_pro INT(9);
DECLARE date_product datetime;
SELECT user_product_id INTO id_pro, date_pro INTO date_product FROM usuario;
END
It doesn’t detect date_product
variable.
2
Answers
To assign
INTO
several variables, use the following syntax:See the MySQL
SELECT ... INTO
syntax.Or don’t use
INTO
: