MySQL Forums
Forum List  »  Newbie

Re: Reading Updating Inserting Indexed Table - Sequence of Events
Posted by: Phillip Ward
Date: February 04, 2019 06:25AM

Basically: Do whichever you would expect to work most often and add something to deal with the [few] cases where it doesn't.

If you would normally expect to insert new records, then do that - and catch the exception that's thrown when you get a duplicate row.

If you would normally expect to update existing rows, then do that - and check to make sure that a row was actually updated and, if not, insert a new one.

OK, there may be "cleverer" ways of doing this with the SQL syntax for particular DBMSs, but that's the basic principal.

Regards, Phill W.

Options: ReplyQuote


Subject
Written By
Posted
Re: Reading Updating Inserting Indexed Table - Sequence of Events
February 04, 2019 06:25AM


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.