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

-- DROP FUNCTION ftib_sga_insc_examen();
CREATE OR REPLACE FUNCTION ftib_sga_insc_examen() RETURNS TRIGGER AS $BODY$
  BEGIN
	   -- Genera un nro de Transaccion
       NEW.nro_transaccion := f_nro_transaccion();
       RETURN NEW;
  END;
$BODY$ LANGUAGE plpgsql;


-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- Trigger de INSERT sobre sga_insc_examen
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- DROP TRIGGER tib_sga_insc_examen  ON sga_insc_examen RESTRICT;
CREATE TRIGGER tib_sga_insc_examen BEFORE INSERT ON sga_insc_examen
    FOR EACH ROW EXECUTE PROCEDURE ftib_sga_insc_examen();
