title: Get result occur from update statement inside stored procedures
body: <p>I want to check the existance of specific record in db table, if it's exist then update if not I want to add new record</p>
  
  <p>I am using stored procedures to do so, First I make update stetement and want to check if it occurs and return 0 then there's no record affected by update statement and that means the record does not exist. </p>
  
  <p>I make like this </p>
  
  <pre><code>DELIMITER //
  CREATE PROCEDURE revokePrivilegeFromUsers(IN userId int(11),  IN privilegeId int(11), IN deletedBy int(11))
  
  BEGIN
    DECLARE isExist int;
  
    isExist = update `user_privileges` set `mode` ='d' ,`updated_by` = deletedBy, `date_time_assigned` =  CURRENT_TIMESTAMP()  where `user_id`= userId and `privilege_id`=privilegeId;
  
   IF  isExist  == 0 THEN
        insert into `user_privileges`(`user_id`,`privilege_id`,`mode`,`date_time_assigned`,`updated_by`)values (userId ,privilegeId ,'d',CURRENT_TIMESTAMP(),deletedBy );
  
   END IF;
  
  
  END //
  
  DELIMITER ;
  </code></pre>
  
  <p>This error occur with me</p>
  
  <pre><code>#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= update `user_privileges` set `mode` ='d' ,`updated_by` = deletedBy, `date_time' at line 6
  </code></pre>
  
  <p>Is the way I am working is supported by mysql?</p>