I am passing table field name as parameter to stored procedure but stored procedure take field name as value instead of field name and throws error.
e.g if i pass value isEnabled via parameter FieldName, Mysql throws error unknown column ‘isEnabled’ in field list, which shows mysql automatically add quote.
Here is sample stored procedure i wrote.
CREATE `VSK_Comments_UpdateAction`(IN FieldName varchar(30),IN FieldValue tinyint,CID bigint)
BEGIN
Update comments Set FieldName=FieldValue WHERE commentid=CID;
END;
Is there is a way so i can properly pass field name dynamically properly.
You can use prepared statements, for example –