EXECUTE BLOCK
AS
  DECLARE VARIABLE v_len INTEGER;
BEGIN
  SELECT f.RDB$CHARACTER_LENGTH
  FROM RDB$RELATION_FIELDS rf
  JOIN RDB$FIELDS f ON rf.RDB$FIELD_SOURCE = f.RDB$FIELD_NAME
  WHERE TRIM(rf.RDB$RELATION_NAME) = 'ENTETE_ENTREES'
    AND TRIM(rf.RDB$FIELD_NAME) = 'DENOMINATION'
  INTO :v_len;

  IF (v_len <> 255) THEN
  BEGIN
    EXECUTE STATEMENT 'ALTER TABLE ENTETE_ENTREES ALTER DENOMINATION TYPE VARCHAR(255)';
  END
END
