I am creating a procedure for storing the food name in the food variable of the procedure, follow the code:
DELIMITER $$
CREATE PROCEDURE armazena_nome(id INT, OUT alimento VARCHAR(20))
BEGIN
SELECT alimentos_dados.nome_alimento INTO alimento FROM alimentos_dados WHERE alimentos_dados.id_alimento = id;
END $$
DELIMITER ;
When I make code below after making the "CALL" in the procedure it should return the food name but returns null:
SELECT @alimento
What am I doing wrong?