-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- Trigger de INSERT tda_sga_certificados
-- TRIGGER AFTER DELETE
-- Tabla: sga_certificados
-- Version 3.0.0
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

-- DROP FUNCTION ftda_sga_certificados();
CREATE OR REPLACE FUNCTION ftda_sga_certificados() RETURNS TRIGGER AS $BODY$
  BEGIN
       -- Borro el registro en la tabla de entidades..
       DELETE FROM sga_g3entidades WHERE entidad = OLD.entidad;
       RETURN OLD;
  END;
$BODY$ LANGUAGE plpgsql;


-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- Trigger de DELETE sobre sga_certificados
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- DROP TRIGGER tda_sga_certificados ON sga_certificados RESTRICT;
CREATE TRIGGER tda_sga_certificados 
    AFTER DELETE ON sga_certificados
    FOR EACH ROW EXECUTE PROCEDURE ftda_sga_certificados();
