title: Creating trigger for table in MySQL database (syntax error)
body: <p>I have trouble defining a trigger for a MySQL database. I want to change a textfield before inserting a new row (under a given condition). This is what I have tried:</p>
  
  <pre><code>CREATE TRIGGER add_bcc
  BEFORE INSERT ON MailQueue
  FOR EACH ROW BEGIN
    IF (NEW.sHeaders LIKE "%support@mydomain.com%") THEN
      SET NEW.sHeaders = NEW.sHeaders + "BCC:internal@mydomain.com";
    END IF;
  END; 
  </code></pre>
  
  <p>But always I get the error "wrong syntax". I got stuck, what am I doing wrong?
  I'm using <strong>MySQL 5.0.51a-community</strong></p>
  
  <p>BTW: Creating an empty Trigger like this works fine:</p>
  
  <pre><code>CREATE TRIGGER add_bcc
  BEFORE INSERT ON MailQueue
  FOR EACH ROW BEGIN
  END; 
  </code></pre>
  
  <p>But this fails, too:</p>
  
  <pre><code>CREATE TRIGGER add_bcc
  BEFORE INSERT ON MailQueue 
  FOR EACH ROW BEGIN
    IF 1=1 THEN
    END IF; 
  END;
  </code></pre>
  
  <p>It's my first time to use stackoverflow.com, so I'm very excited if it is helpful to post something here :-)</p>