-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- Trigger de DELETE tda_sga_planes
-- TRIGGER AFTER DELETE
-- Tabla: sga_planes
-- Version 3.0.0
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

-- DROP FUNCTION ftda_sga_planes();
CREATE OR REPLACE FUNCTION ftda_sga_planes() 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_planes
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- DROP TRIGGER tda_sga_planes ON sga_planes RESTRICT;
CREATE TRIGGER tda_sga_planes 
    AFTER DELETE ON sga_planes
    FOR EACH ROW EXECUTE PROCEDURE ftda_sga_planes();
