Hello, I have a stored procedure, which has got executed without any errors, but gives me an error "#1054: Unknown column 'templateName' in where clause" when I run it.
The stored procedure is
delimiter //
DROP PROCEDURE getData//
CREATE DEFINER=root@localhost PROCEDURE getData(IN templateName VARCHAR(45),IN templateVersion VARCHAR(45),IN userId VARCHAR(45))
BEGIN
set @version = CONCAT("SELECT 'saveOEMsData_answersVersion' FROM saveOEMsData where 'saveOEMsData_templateName' = ",templateName," and 'saveOEMsData_templateVersion' = ",templateVersion," and 'saveOEMsData_userId'= ",userId);
PREPARE s1 from @version;
EXECUTE S1;
END
//
delimiter ;
Now I call it using "call getData('templateName','1','285');". And whenever I call it, I get the mentioned error. What could the problem be?? It surely is syntactical, I have been reading the mysql manuals for 2 days and have come out without!!
Any help would be great!! Thanks