title: How to return a MySQL procedure as a trigger?
body: <p>I'm new to MySQL procedures. I need to emulate some code that I usually do with PLpgSQL, something like this:</p>
  
  <pre><code>DROP FUNCTION IF EXISTS "aprtr_controlo_tabelas_ins_upd" () CASCADE;
  CREATE OR REPLACE FUNCTION "aprtr_controlo_tabelas_ins_upd" ()         
  RETURNS trigger AS
  
  $BODY$
          BEGIN
              IF (TG_OP = 'INSERT') THEN
                  NEW.data_ult_actual := current_timestamp;
                  NEW.id_utiliz_ins := current_user;
              RETURN NEW;
              ELSEIF (TG_OP = 'UPDATE') THEN
                  NEW.data_ult_actual := current_timestamp;
                  NEW.id_utiliz_upd := current_user;
              RETURN NEW;
              END IF;
  
              RETURN NULL;
          END;
  $BODY$
          LANGUAGE PLpgSQL
          CALLED ON NULL INPUT
          VOLATILE
          EXTERNAL SECURITY DEFINER; 
  </code></pre>
  
  <p>It is possible in MySQL to write procedures that return a trigger? Or better, can I use a procedure code and call it trigger in an operation of INSERT or UPDATE?</p>
  
  <p>Best Regards,</p>