You have compared the column's internal size with the length of the value given by the user.
For example, column having integer would have internal size 4 and if I give the value 12121 which is the correct input for the field will fail here because as per your logic column internal size (4) < len(value) (5).