KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to create a transaction in MySql which will roll back when an exception occurs during the transaction. Similar using the following in a stored procedure. DECLARE EXIT HANDLER FOR SQLEXCEPTION ROLLBACK; Can this be done without writing a stored procedure? For example the following snippet should roll back the first insert because the second insert would fail. START TRANSACTION; INSERT INTO mytable VALUE 'foo1',2,'foo3','foo4' INSERT INTO mytable VALUE 'foo1','foo2','foo3','foo4' COMMIT
Tags (comma-separated)
Save Edits
Cancel