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

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


-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- Trigger de INSERT sobre sga_planes_versiones
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- DROP TRIGGER tib_sga_planes_versiones ON sga_planes_versiones RESTRICT;
CREATE TRIGGER tib_sga_planes_versiones BEFORE INSERT ON sga_planes_versiones
    FOR EACH ROW EXECUTE PROCEDURE ftib_sga_planes_versiones();
