CREATE TABLE ESCALA (
ID_ESCALA INTEGER NOT NULL PRIMARY KEY,
DESCRICAO VARCHAR(50),
DATA_INICIO DATE,
HORA_INICIO TIME,
DATA_TERMINO DATE,
HORA_TERMINO TIME
);

CREATE GENERATOR GEN_ID_ESCALA ;

SET TERM ^;

CREATE TRIGGER TRIG_GEN_ID_ESCALA FOR ESCALA
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
   NEW.ID_ESCALA = gen_id(GEN_ID_ESCALA,1);
END
^

COMMIT WORK^
SET TERM;^

UPDATE PARAMETROS SET SCRIPT = '100';
