0

There is probably a simple solution to this but I can't figure it out: I'm trying to UPDATE in a While loop (from the phpMyAdmin panel):

DELIMITER $$
CREATE PROCEDURE proc_name()
BEGIN
DECLARE c int ;
SET c = 509 ;
WHILE c<637 DO
  UPDATE foobar
    SET `qwerty`= 10000+c-509
    WHERE `product_id` IS c ;
  SET c = c + 1 ;
END WHILE;
END $$
DELIMITER ;

The error:

..near 'c ; SET c = c + 1 ; END WHILE ; END' at line 9.

1 Answer 1

2

Try changing it to this:

WHERE `product_id` = c ;
Sign up to request clarification or add additional context in comments.

1 Comment

@Igor -- it passed -- you mean the SP was created successfully? And then you called it? Does your table have a product id of 509?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.