Hi I tried implementing the below stored procedure which always takes my if condition as true and implements .
CREATE DEFINER=`root`@`localhost` PROCEDURE `InsertOpen`(in uid varchar(11),in S_ID varchar(20)) BEGIN if(SELECT COUNT(Slot_ID) FROM smart_scheduler1.work_schedule where Employee_ID=uid AND Schedule_ID=S_ID = 0) THEN UPDATE `smart_scheduler1`.`work_schedule` SET `Employee_ID`=uid WHERE `Schedule_ID`=S_ID; ELSE SELECT COUNT(Slot_ID) FROM smart_scheduler1.work_schedule where Employee_ID=uid AND Schedule_ID=S_ID; END IF; END
My question is how do I compare a query with a value or integer in stored procedure if condition?
I am novice in Database , please help me. I would be very pleased if you could get me a good tutorial on stored procedure as I was not able to find much materials on stored procedures online.