Passing Variable Values as a parameter Name in MySQL

Reply

Join Date: Jul 2007
Posts: 24
Reputation: atal is an unknown quantity at this point 
Solved Threads: 0
atal atal is offline Offline
Newbie Poster

Passing Variable Values as a parameter Name in MySQL

 
0
  #1
Aug 16th, 2007
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC