MySQL Forums
Forum List  »  Stored Procedures

Re: What is incorrect for this mySQL stored procedure?
Posted by: Peter Brawley
Date: September 01, 2013 08:40PM

Ascii() returns the smallint value of the first char of a string, probably not what you have in mind.

Setting SerialNo = SerialNo+1 doesn't even guarantee uniqueness, never mind sequential values. If you really need sequential values, define an auto_increment primary key in a keys table and when you need a new serial value, take the next unused one and mark it used in a blocked transaction. Otherwise just use auto_increment, which guarantees uniqueness but not an unbroken sequence.

Options: ReplyQuote

Written By
Re: What is incorrect for this mySQL stored procedure?
September 01, 2013 08:40PM

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.