title: mysql transaction error handling
body: <pre><code> DECLARE EXIT HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND 
  BEGIN 
      ROLLBACK; 
  END;
  START TRANSACTION;      
  
      UPDATE tbl_order SET TransactionID="abc" WHERE OrderID=1;
      UPDATE tbl_order SET TransactionID="xyz" WHERE OrderID=;
      UPDATE tbl_order SET TransactionID="zzz" WHERE OrderID=13;
  
  
  COMMIT;
  </code></pre>
  
  <p>for some reason order 1 and 13 are filled without rollback and  i get syntax error for the exit hadler.</p>
  
  <pre><code>Query:  DECLARE EXIT HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND BEGIN ROLLBACK
  
  Error Code: 1064
  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECLARE EXIT HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND 
  BEGIN 
      ROLLBACK' at line 1
  </code></pre>
  
  <p>can someone help me figure out what i'm doing wrong?</p>
  
  <p>Thanks in advance</p>
  
  <p><strong>EDIT</strong></p>
  
  <p><strong>UPDATE tbl_order SET TransactionID="xyz" WHERE OrderID=;</strong></p>
  
  <p>is intentional</p>