/******************************************************************************/
/****              Generated by IBExpert 17/08/2022 13:55:17               ****/
/******************************************************************************/

/******************************************************************************/
/****     Following SET SQL DIALECT is just for the Database Comparer      ****/
/******************************************************************************/
SET SQL DIALECT 3;



/******************************************************************************/
/****                                Tables                                ****/
/******************************************************************************/



CREATE TABLE TBPERFIL_FAMILIA_DESCONTO (
    PERFIL_ID           VARCHAR(10) NOT NULL,
    FAMILIA_ID          INTEGER NOT NULL,
	PERCENTUAL_DESCONTO NUMERIC(10,2)
);

/******************************************************************************/
/****                             Primary keys                             ****/
/******************************************************************************/

ALTER TABLE TBPERFIL_FAMILIA_DESCONTO ADD PRIMARY KEY (PERFIL_ID, FAMILIA_ID);


/******************************************************************************/
/****                               Triggers                               ****/
/******************************************************************************/



SET TERM ^ ;



/******************************************************************************/
/****                         Triggers for tables                          ****/
/******************************************************************************/



/* Trigger: TTBPERFIL_FAMILIA00IU */
CREATE OR ALTER TRIGGER TTBPERFIL_FAMILIA_DESCONTO_01IU FOR TBPERFIL_FAMILIA_DESCONTO
ACTIVE BEFORE INSERT OR UPDATE POSITION 0
AS
begin
  if(new.PERFIL_ID <> ' ')then
  begin
     new.PERFIL_ID = trim(new.PERFIL_ID);
  end
end
^

SET TERM ; ^