-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- TRIGGER BEFORE INSERT
-- Tabla: sga_mesas_examen
-- Version 3.0.0
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

-- DROP FUNCTION ftib_sga_mesas_examen();
CREATE OR REPLACE FUNCTION ftib_sga_mesas_examen() RETURNS TRIGGER AS $BODY$
  BEGIN
	   -- Genera un registro en la tabla de entidades..
       NEW.entidad := f_generar_entidad(400);
       RETURN NEW;
  END;
$BODY$ LANGUAGE plpgsql;


-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- Trigger de INSERT sobre sga_mesas_examen
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- DROP TRIGGER tib_sga_mesas_examen  ON sga_mesas_examen RESTRICT;;
CREATE TRIGGER tib_sga_mesas_examen BEFORE INSERT ON sga_mesas_examen
    FOR EACH ROW EXECUTE PROCEDURE ftib_sga_mesas_examen();
