CREATE TABLE NOTA (
ID_NOTA INTEGER NOT NULL PRIMARY KEY,
ID_ENTRADA INTEGER NOT NULL,
VALOR DECIMAL(15,2)
);

CREATE GENERATOR GEN_ID_NOTA;

SET TERM ^ ;

CREATE TRIGGER TRIG_GEN_ID_NOTA FOR NOTA
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
   NEW.ID_NOTA = gen_id(GEN_ID_NOTA,1);
END
 ^

COMMIT WORK ^
SET TERM ;^
