title: MySQL - It is possible to call functions to execute trigger operations?
body: <p>In my schema I have many tables with common fields that I need to fill. This are basicaly control fields like this ones:</p>
  
  <pre><code>id_db_user
  date_creation
  date_last_update
  </code></pre>
  
  <p>I have done two triggers to fill this fields:</p>
  
  <pre><code>-- Trigger DDL Statements
  delimiter |
  CREATE TRIGGER control_insert BEFORE INSERT ON EZT_SOCIETIES
  
    FOR EACH ROW BEGIN
  
      SET NEW.id_db_user    = current_user;
  
      SET NEW.date_creation = current_timestamp;
  
    END;
  | delimiter ;
  
  
  delimiter |
  CREATE TRIGGER control_update BEFORE UPDATE ON EZT_SOCIETIES
  
    FOR EACH ROW BEGIN
  
      SET NEW.date_last_update = current_timestamp;
  
    END;
  | delimiter ;
  </code></pre>
  
  <p>My question is: Can I write some function to call the operations inside the trigger? Something like this:</p>
  
  <pre><code>function fn_control_insert
      SET NEW.id_db_user    = current_user;
      SET NEW.date_creation = current_timestamp;
  </code></pre>
  
  <p>and then call this function in the trigger like:</p>
  
  <pre><code>delimiter |
  CREATE TRIGGER control_insert BEFORE INSERT ON EZT_SOCIETIES
  
    FOR EACH ROW BEGIN
  
      call fn_control_insert;
  
    END;
  | delimiter ;
  </code></pre>
  
  <p>This is possible to do in MySQL?</p>
  
  <p>Best Regards,</p>