MySQL Forums
Forum List  »  Stored Procedures

Re: help with my stored procedure
Posted by: Peter Brawley
Date: May 29, 2017 10:54PM

> i need build an stored procedure

What problem do you hope to solve by tutting this code in a stored procedure?

As for the code, max(id) is not a reliable indicator of the id assigned on your insert. Another insert by another user may have intervened. Read about last_insert_id(), and use it instead.

And, keeping a comma-separated list of userIDs in a column is a terrible idea. It breaks a cardinal rule, in fact the first rule of relational databases: one cell, one value.

So before you go any further, read about relational databases, and about database design.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: help with my stored procedure
82
May 29, 2017 10:54PM


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.