title: MySQL Triggers - Error getting DDL for object
body: <p>I created two triggers and I am getting an error whenever I try to alter the 'Computers' table schema:</p>
  
  <p><a href="https://i.stack.imgur.com/MdEUN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MdEUN.png" alt="enter image description here"></a></p>
  
  <p>TRIGGER trgMarkUpd:</p>
  
  <pre><code>DELIMITER $$
  
  CREATE TRIGGER `trgMarkUpd`
  BEFORE UPDATE on Computers
  FOR EACH ROW
  BEGIN
      If old.OutofSync = 3 THEN
       SET new.OutofSync = 2;
       END IF;
  END;
  DELIMITER ;
  </code></pre>
  
  <p>TRIGGER trgMarkNew:</p>
  
  <pre><code> DELIMITER $$
  
      CREATE TRIGGER `trgMarkNew`
      BEFORE INSERT on Computers
      FOR EACH ROW
     BEGIN
      SET new.OutofSync = 1 ;   
      END;
      DELIMITER ;
  </code></pre>
  
  <p>TRIGGER trgSoftwareLicenseDetails:</p>
  
  <pre><code>    DELIMITER $$
  
      CREATE TRIGGER `trgSoftwareLicenseDetails`
      BEFORE UPDATE on SoftwareLicenseDetails
      FOR EACH ROW
      BEGIN
  
      IF new.Flag = 0 THEN
          INSERT INTO audithistory (audit_date, audit_field, audit_oldvalue, audit_changelog_fk, audit_newvalue, audit_assetid_fk) VALUES (Now(),''Software License Details'', (SELECT Title FROM SoftwareTypes WHERE ID = 
          (SELECT SoftwareNameFK FROM SoftwareLicenseDetails
          WHERE  ComputerFK=new.ComputerFK
          ORDER BY ID Desc
          LIMIT 1)), (SELECT MAX(ID) FROM Changelog as ChangelogID ), ''License Added'',new.ComputerFK);
  
      ELSEIF new.Flag = 1 THEN
          INSERT INTO audithistory (audit_date, audit_field, audit_oldvalue, audit_changelog_fk, audit_newvalue, audit_assetid_fk) VALUES (Now(),''Software License Details'', ''N/A'', (SELECT MAX(ID) FROM Changelog as ChangelogID ), ''License Deleted'',old.ComputerFK);
      END IF;
  
  END;
      DELIMITER ;
  </code></pre>
  
  <p>Can anybody tell me what's wrong with the SQL??</p>
  
  <p>Note that I did not get any error messages when creating the TRIGGERS.</p>