MySQL Forums
Forum List  »  Newbie

Warning 1287: setting variables deprecated
Posted by: Tim Bomgardner
Date: September 05, 2020 04:22PM

This query generates Warning 1287 in MySQL 8.0.21: Setting user variables within expressions is deprecated and will be removed in a future release. Please set variables in separate statements instead.

SET @i = -1;
UPDATE `tb_test`
SET `order` = (@i := @i + 1)

How can the variable be incremented in a separate statement?

Options: ReplyQuote


Subject
Written By
Posted
Warning 1287: setting variables deprecated
September 05, 2020 04:22PM


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.