UPDATE TBMENU T SET T.tipo = '0' WHERE T.controle = 21070;

UPDATE OR INSERT INTO TBMENU (CONTROLE, GRUPO, SUBGRUPO, TIPO, URL, DESCRICAO)
                      VALUES (21071, 'FIS', 'FIS', '1', '', 'CADASTRO DE TABELA IBPT')
                    MATCHING (CONTROLE);

COMMIT WORK;


CREATE TABLE TBAPI_IBPTAX (
    ID INTEGER NOT NULL,
    ESTABELECIMENTO_ID INTEGER,
    TOKEN VARCHAR(200),
    DATAHORA TIMESTAMP DEFAULT 'NOW');
	
ALTER TABLE TBAPI_IBPTAX
ADD CONSTRAINT PK_TBAPI_IBPTAX
PRIMARY KEY (ID);

CREATE SEQUENCE GTBAPI_IBPTAX;

create trigger ttbapi_ibptax_b01i for tbapi_ibptax
active before insert position 0
as
begin
  if (new.id is null) then
    new.id = gen_id(gtbapi_ibptax,1);
end;