Reputation:
Is there any built in way in mysql in which it either inserts all the given rows, or reverts all inserted rows if an error(eg duplicate error) occurs?
Upvotes: 1
Views: 65
Reputation: 5780
What you're referring to is commonly called a transaction. You should begin a transaction and perform a series of inserts and rollback upon failure.
See this document for further details on transactions.
Upvotes: 1