How to get the answers version and use it in IF loop
        Posted  
        
            by sai
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by sai
        
        
        
        Published on 2010-04-20T04:06:39Z
        Indexed on 
            2010/04/20
            4:13 UTC
        
        
        Read the original article
        Hit count: 326
        
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.
© Stack Overflow or respective owner