Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8016159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:27:56+00:00 2026-06-04T20:27:56+00:00

In MySql UPDATE `inventoryentry` SET `Status` = 1 WHERE `InventoryID`=92 AND `ItemID`=28; It successfully

  • 0

In MySql

UPDATE `inventoryentry` SET `Status` = 1 WHERE `InventoryID`=92 AND `ItemID`=28;

It successfully update only one row , where inventoryID = 92 and itemID=28 , the following message displayed.

1 row(s) affected 

when I put this on stored procedure, as follow

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$$

calling stored procedures

CALL Sample(28,10,92)

It update all the status = 1 in inventoryentry against InventoryID (i.e. 92) ignoring ItemID, instead of updating only one row. The following message displayed!

5 row(s) affected 

Why Stored procedure ignoring itemID in update statement ? or Why Stored procedure updating more than one time? But without Stored procedure it working fine.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:27:58+00:00Added an answer on June 4, 2026 at 8:27 pm

    You need to use different variable names apart from your field name, also use the table name with the columns for better understanding like i used in following:

    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 `QuantityOnHand`.`Id`=itemID;
    
    UPDATE `inventoryentry` SET `Status` = 1 WHERE `InventoryID`=invID AND 
    `inventoryentry`.`ItemID`=itemID;
    
    
    END$$
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following code to update my mysql table where both moving50
I can't do this in MySQL UPDATE tableA, tableB SET tableA.column1 = SUM(tableB.column2) WHERE
I am trying to do this in mysql: UPDATE table SET value = value
Consider the query (it runs on both Oracle and MySQL) UPDATE table1 SET something_id
I'd like to convert this for us in MySQL: UPDATE product SET price =
I have a mysql table with a row called log. I need to update
I have a MySQL UPDATE statement that uses a CASE clause UPDATE partsList SET
This code doesn't work on mysql: update member set member.xy = memba.surba from memba
How can I search for quotes with mysql update command? I'm using the following
I have this mysql query: UPDATE `table`.`wp_12_postmeta` SET `meta_value` = 'yyy' WHERE `wp_12_postmeta`.`meta_id` =5

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.