| | |
Passing Variable Values as a parameter Name in MySQL
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2007
Posts: 24
Reputation:
Solved Threads: 0
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
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
- Parameter error for executeNonQuery() (VB.NET)
- variable arguments in C (C)
- Passing formname as variable (Visual Basic 4 / 5 / 6)
- Selecting MYSQL into fields (HTML and CSS)
- Return values from a method by not using return (Java)
- Passing variables to and from PHP (JavaScript / DHTML / AJAX)
- Passing Variables/Parameters - By Ref/Value? (Computer Science)
- Array Values not found in Methods (Java)
- Variable Validation & MYSQL (PHP)
Other Threads in the MySQL Forum
- Previous Thread: how do i import data from a csv file to my mysql database
- Next Thread: MySql installing problem
Views: 3345 | Replies: 0
| Thread Tools | Search this Thread |
Tag cloud for MySQL
"use" 1 agplv3 alfresco amazon api artisticlicense breathalyzer camparingtocolumns changingprices cmg contentmanagement count court crm data database design developer development drupal dui ec2 eliminate email enter enterprise error eudora facebook form foss gartner gnu government gpl greenit groklaw groupware images innerjoins insert ip joebrockmeier join journalism keywords laptop law legal license licensing linux maintenance managing matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource operand oracle pdf penelope php priceupdating referencedesign remove reorderingcolumns resultset saas select sharepoint sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency update virtualization





