-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- Trigger de DELETE tdb_sga_requisitos_x_accion
-- BEFORE DELETE
-- Tabla: sga_requisitos_x_accion
-- Version 3.0.0
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

-- DROP FUNCTION ftdb_sga_requisitos_x_accion();
CREATE OR REPLACE FUNCTION ftdb_sga_requisitos_x_accion () RETURNS trigger AS 
$BODY$
BEGIN
   -- Borro el registro en la tabla de entidades..
   DELETE FROM sga_requisitos_conf_x_oper
     WHERE sga_requisitos_conf_x_oper.requisito_accion = OLD.requisito_accion;
   
   RETURN OLD;
END;
$BODY$
LANGUAGE 'plpgsql';


-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- Trigger de DELETE sobre sga_requisitos_x_accion
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- DROP TRIGGER tdb_sga_requisitos_x_accion ON sga_requisitos_x_accion RESTRICT;
CREATE TRIGGER tdb_sga_requisitos_x_accion 
    BEFORE DELETE ON sga_requisitos_x_accion
    FOR EACH ROW EXECUTE PROCEDURE ftdb_sga_requisitos_x_accion();
