SET TERM ^ ;

CREATE OR ALTER TRIGGER ALUMNOS_PLANES_BI FOR ALUMNOS_PLANES
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
  IF (NEW.NRO_ALUMNO_PLAN IS NULL) THEN BEGIN
    NEW.NRO_ALUMNO_PLAN = GEN_ID(ORDEN_GEN, 1);
  END
END^

SET TERM ; ^

-----
