title: In MySql Stored Procedure updating more than one time
body: <p><strong>In MySql</strong></p>
  
  <pre><code>UPDATE `inventoryentry` SET `Status` = 1 WHERE `InventoryID`=92 AND `ItemID`=28;
  </code></pre>
  
  <p>It successfully update only one row , where inventoryID = 92 and itemID=28 , the following message displayed.</p>
  
  <pre><code>1 row(s) affected 
  </code></pre>
  
  <p>when I put this on stored procedure, as follow </p>
  
  <pre><code>CREATE DEFINER=`root`@`localhost` PROCEDURE `Sample`(IN itemId INT, IN itemQnty 
  DOUBLE, IN invID INT)
  
  BEGIN
  
  DECLARE crntQnty DOUBLE;
  DECLARE nwQnty DOUBLE;
  
  SET crntQnty=(SELECT `QuantityOnHand` FROM `item` WHERE id=itemId);
  SET nwQnty=itemQnty+crntQnty;
  UPDATE `item` SET `QuantityOnHand`=nwQnty WHERE `Id`=itemId;
  
  UPDATE `inventoryentry` SET `Status` = 1 WHERE `InventoryID`=invID AND 
  `ItemID`=itemId;
  
  
  END$$
  </code></pre>
  
  <p><strong>calling stored procedures</strong></p>
  
  <pre><code>CALL Sample(28,10,92)
  </code></pre>
  
  <p>It update all the status = 1 in <strong>inventoryentry</strong> against <strong>InventoryID</strong> (i.e. 92) ignoring ItemID, instead of updating only one row. The following message displayed!</p>
  
  <pre><code>5 row(s) affected 
  </code></pre>
  
  <p>Why Stored procedure ignoring itemID in update statement ? or Why Stored procedure updating more than one time? But without Stored procedure it working fine.</p>