-- drop PROCEDURE if exists `update_device`; CREATE DEFINER = `eq`@`` PROCEDURE `eq`.`update_device`( IN empIdIN int(10), IN deviceIdIN varchar(50) ) SQL SECURITY INVOKER BEGIN DECLARE empids, isvideo int(10); select empId into empids from device_information where deviceId = deviceIdIN; update `user` set device = 0,deviceId='' where empId = empids; update `user` set device = 1 ,deviceId=deviceIdIN where empId = empIdIN; update device_information set empId = empIdIN where deviceId = deviceIdIN; END