MySQL Forums :: Stored Procedures :: ROW_COUNT() results in NULL from stored procedure


Advanced Search

Re: ROW_COUNT() results in NULL from stored procedure
Posted by: Rick James ()
Date: June 01, 2016 11:49AM

MAX(evID)+1 -- Will this Sproc be run by multiple connections at the 'same' time? If so, you probably have a bug in computing that id. Or maybe you have a BEGIN...COMMIT around the call to the sproc? Even so, you would need FOR UPDATE.

Better yet, use AUTO_INCREMENT instead of simulating it.

Another bug... SET @sql = CONCAT(@sql, "'",...,"',"); fails to escape the parameters. If any has "'" in it, you will get syntax errors. Also it is an open invitation to hackers to mess with your system.

The whole sproc is a lot of work to replace a single simple INSERT with AUTO_INCREMENT. Get rid of the Stored Procedure.

Options: ReplyQuote


Subject Views Written By Posted
ROW_COUNT() results in NULL from stored procedure 2900 Frank Yingst 05/18/2016 06:32PM
Re: ROW_COUNT() results in NULL from stored procedure 361 Peter Brawley 05/18/2016 07:59PM
Re: ROW_COUNT() results in NULL from stored procedure 397 Frank Yingst 05/18/2016 10:06PM
Re: ROW_COUNT() results in NULL from stored procedure 379 Frank Yingst 05/18/2016 08:21PM
Re: ROW_COUNT() results in NULL from stored procedure 372 Peter Brawley 05/19/2016 10:17AM
Re: ROW_COUNT() results in NULL from stored procedure 327 Rick James 06/01/2016 11:49AM


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.