CREATE TABLE DESPESA_AVULSA (
ID_DESPESA_AVULSA INTEGER NOT NULL PRIMARY KEY,
ID_P_S INTEGER,
QTD INTEGER,
VALOR_UNIT DECIMAL(15,2),
COMANDA INTEGER,
USUARIO VARCHAR(10),
DATA DATE,
HORA TIME,
TAXA DECIMAL(3,2),
FORMA_PAG VARCHAR(20)
);

CREATE GENERATOR GEN_ID_DESPESA_AVULSA ;

SET TERM ^;

CREATE TRIGGER TRIG_GEN_ID_DESPESA_AVULSA FOR DESPESA_AVULSA
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
   NEW.ID_DESPESA_AVULSA = gen_id(GEN_ID_DESPESA_AVULSA,1);
END
^

COMMIT WORK^
SET TERM;^
