MySQL Forums
Forum List  »  Stored Procedures

Yet another problem with update
Posted by: Michal Gdak
Date: December 21, 2013 05:32PM

Hi,
I'm a newbie to stored procedures in MySQL so please excuse if problem is trival.
I looked through the web but couldn't find an answer for the issue.

In a stored procedure I try to update many rows however only one row is update.
Here is the code:

IF users1 IS NOT NULL THEN
insert into debug_log (message) values (CONCAT('update users set status = "2" where id in (', users1, ')'));
END IF;

update users u set u.status = "2" where u.id in (users1);

And the log which is created:
update users set status = "2" where id in (11,13,14)

As a result only the status of user with id = 11 is changed.
However if I run the logged SQL separetly everything works fine (all rows get updated).

Any ideas what might be wrong?

Thanks for help.

Options: ReplyQuote


Subject
Views
Written By
Posted
Yet another problem with update
1614
December 21, 2013 05:32PM
812
December 21, 2013 11:30PM
903
December 22, 2013 12:15AM
821
December 22, 2013 01:18PM
803
December 22, 2013 05:08PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.