I have written the below mentioned SP in MySQL.
CREATE DEFINER=`root`@`localhost` PROCEDURE `IsUploaderLoggedIn`(
IN `inMobile` CHAR(10),
IN `inSessionID` varchar(34)
)
BEGIN
DECLARE isLoggedIn TINYINT(1) DEFAULT 0;
DECLARE uploaderType VARCHAR(10) DEFAULT '';
CALL GetUploaderType(inMobile, @x);
SELECT @x INTO uploaderType;
IF uploaderType = "surveyor" THEN
SELECT Count(*) INTO isLoggedIn FROM surveyors WHERE Mobile = inMobile AND SessionID = inSessionID;
SELECT "surveyor";
ELSE
SELECT Count(*) INTO isLoggedIn FROM uploaders WHERE Mobile = inMobile AND SessionID = inSessionID;
SELECT "uploader";
END IF;
SELECT isLoggedIn;
END;
On executing the procedure in Navicat, for a given value of inMobile
and inSessionID
, the values returned are:
Result 1: usertype | surveyor
Result 1(2): uploader | uploader
Result 1(3): 0 or 1 as the case may be
Where as, the value of Result 1(2)s should have been surveyor | surveyor.
What is wrong with my script please?
Aucun commentaire:
Enregistrer un commentaire