How to get the answers version and use it in IF loop
- by sai
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 ;
I am retreiving saveOEMsData_answersVersion, but I have to use it in an IF loop, as in if the version == 1, then I would use a query, else I would use something else. But I am not able to use the version. Could someone help with this?? I am only able to print but not able to use the version.