MySQL Forums
Forum List  »  Newbie

Re: ON DUPLICATE KEY UPDATE
Posted by: M A
Date: October 05, 2016 09:43PM

Thanks for reply. However, in the stored procedure I need 10 unique random numbers inserted that are specified in the while loop. Using Ignore will drop records. Sorry for not explaining clearly.

For instance if the while loop is set for 10 as in the posted stored procedure then 10 unique random numbers are inserted. I was hoping that the example I provided would have created 10 records (1 thru 10). Perhaps there is catch for the 1062 (duplicate) error that will keep executing the until the insert is successful?

Also, I realize that I could do a "Select" statement to check for duplicate prior to insert but the table I will be creating will be very large and performance will be unacceptable as the table grows.

And finally, there will be an additional column in tblRandomNumber called setNum that will have 10 random numbers for each set. For instance,
1,3
1,6
1,25
until their are 10 unique random records for setNum 1
2,16
2,4
2,13
until their are 10 unique random records for setNum 2
etc

Again, I apologize for not being specific at the beginning, and thanks for your time and suggestions.

PS. The procedure is not complete and does not include the loop for the "numSet" value. I hope this makes sense.

Options: ReplyQuote


Subject
Written By
Posted
M A
October 02, 2016 07:55PM
October 02, 2016 11:58PM
M A
October 05, 2016 12:23AM
October 05, 2016 09:53AM
Re: ON DUPLICATE KEY UPDATE
M A
October 05, 2016 09:43PM
October 06, 2016 11:24AM
M A
October 06, 2016 08:59PM
October 06, 2016 09:16PM


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.