Unknown Column 'template' in where clause, while using a stored procedure.
Posted
by sai
on Stack Overflow
See other posts from Stack Overflow
or by sai
Published on 2010-04-19T20:41:23Z
Indexed on
2010/04/19
20:43 UTC
Read the original article
Hit count: 180
mysql
|stored-procedures
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
© Stack Overflow or respective owner