title: Cannot CREATE TRIGGER in SQLite3
body: <p>I have issues creating this trigger second_loop in sqlite3:
  It is part of more code but it's this exact part that's giving errors.
  When I execute the code on the database I get the following: <strong>near "CREATE": syntax error</strong>.</p>
  
  <p>I am sure the part inside the trigger works well as I've tested it separately, but there must be some other kind of problem with this.</p>
  
  <p>Note that I have another trigger in the same SQL and it is working just fine!</p>
  
  <p>Please advise, Thanks</p>
  
  <pre><code>CREATE TRIGGER second_loop AFTER UPDATE OF stack_count ON global WHEN NEW.stack_count&lt;&gt;0
  
  BEGIN
   CREATE TEMP TABLE last_row(id INTEGER PRIMARY KEY, unvisited INTEGER DEFAULT 1, predecessor INTEGER DEFAULT 0, discovery INTEGER DEFAULT 0, finish INTEGER DEFAULT 0);
  
   INSERT INTO last_row
          SELECT *
          FROM nodes
          WHERE id = (SELECT node_id
                     FROM stack
                     ORDER BY oid DESC LIMIT 1);
  
   UPDATE last_row SET unvisited =0, predecessor = (SELECT parent_id FROM global), discovery = (SELECT time FROM global);
  
   UPDATE global SET current_id = (SELECT node_id FROM stack WHERE ROWID = (SELECT MAX(ROWID) FROM stack));
   UPDATE global SET time = time + 1;
  
   DELETE FROM stack WHERE ROWID = (SELECT MAX(ROWID));
  
   INSERT INTO stack(node_id)
     SELECT DISTINCT edges.target_id
     FROM nodes, edges, global
     WHERE edges.source_id=global.current_id AND nodes.unvisited=1;
  
    -- update stack count to go to second_loop trigger
    UPDATE global SET stack_count = stack_count + 1;
   END;
  </code></pre>