CREATE TABLE TBMENU_APP (
    ID INTEGER NOT NULL,
    DESCRICAO VARCHAR(100));

ALTER TABLE TBMENU_APP
ADD CONSTRAINT PK_TBMENU_APP
PRIMARY KEY (ID);

CREATE SEQUENCE GTBMENU_APP;

SET TERM ^ ;

create trigger ttbmenu_app_b01i for tbmenu_app
active before insert position 0
as
begin
  if (new.id is null) then
    new.id = gen_id(gtbmenu_app,1);
end
^

SET TERM ; ^


UPDATE OR INSERT INTO TBMENU_APP (ID, DESCRICAO)
                          VALUES (1, 'REGISTRO DE CLIENTES')
                        MATCHING (ID);
UPDATE OR INSERT INTO TBMENU_APP (ID, DESCRICAO)
                          VALUES (2, 'REGISTRO DE OCORRÊNCIAS')
                        MATCHING (ID);
UPDATE OR INSERT INTO TBMENU_APP (ID, DESCRICAO)
                          VALUES (3, 'REGISTRO DE VISITA')
                        MATCHING (ID);
UPDATE OR INSERT INTO TBMENU_APP (ID, DESCRICAO)
                          VALUES (4, 'REGISTRO DE PEDIDO')
                        MATCHING (ID);
UPDATE OR INSERT INTO TBMENU_APP (ID, DESCRICAO)
                          VALUES (5, 'REGISTRO DE PONTO')
                        MATCHING (ID);

COMMIT WORK;

