CREATE TABLE CHEQUE (
COD_GERAL_CHEQUE INTEGER NOT NULL,
ID_CONTA VARCHAR(10) NOT NULL,
ID_CHEQUE INTEGER NOT NULL,
BANCO VARCHAR(50) NOT NULL,
ID_FORNECEDOR_CLIENTE VARCHAR(18),
VALOR DECIMAL(15,2),
DATA_EMISSAO DATE,
DATA_COMPENSACAO DATE,
HISTORICO VARCHAR(100),
TIPO_CHEQUE CHAR(1),
PREDATADO DATE,
REPASSADO VARCHAR(90),
TITULAR VARCHAR(90)
);

CREATE GENERATOR GEN_COD_GERAL_CHEQUE;

SET TERM ^ ;

CREATE TRIGGER TRIG_GEN_COD_GERAL_CHEQUE FOR CHEQUE
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
   NEW.COD_GERAL_CHEQUE = gen_id(GEN_COD_GERAL_CHEQUE,1);
END
 ^

COMMIT WORK ^
SET TERM ;^
