943,865 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 4401
  • MySQL RSS
Aug 16th, 2007
0

Passing Variable Values as a parameter Name in MySQL

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
atal is offline Offline
24 posts
since Jul 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: how do i import data from a csv file to my mysql database
Next Thread in MySQL Forum Timeline: MySql installing problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC