atal 0 Newbie Poster

Hello All,
I have been trying to pass variable values as a parameter name in MySQL Stored Procedure Insert Statement when i directly pass the parameter name it works fine, but when i asign the paramter name from a variable value it is passing those values as a value not as a parameter.

DELIMITER $$

DROP PROCEDURE IF EXISTS `test`.`Insert` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `Insert`(IN param1 VARCHAR(50), IN param2 VARCHAR(50))
BEGIN
declare @var1 CHAR(6);
set @var1:=concat('param',2);


INSERT INTO message(Name, Message) VALUES(param1,@var1);

END $$

DELIMITER ;


the above stamenet takes param2 which is coming from var1 as a value to the param2, and i want it as a param2 to be passed.

any idea?

Khaled