-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- Trigger de DELETE tda_sga_llamados_mesa
-- AFTER DELETE
-- Tabla: sga_llamados_mesa
-- Version 3.0.0
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

-- DROP FUNCTION ftda_sga_llamados_mesa();
CREATE OR REPLACE FUNCTION ftda_sga_llamados_mesa () 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_llamados_mesa
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- DROP TRIGGER tda_sga_llamados_mesa ON sga_llamados_mesa RESTRICT;
CREATE TRIGGER tda_sga_llamados_mesa 
    AFTER DELETE ON sga_llamados_mesa
    FOR EACH ROW EXECUTE PROCEDURE ftda_sga_llamados_mesa();
