Insert NIB into database

Asked

Viewed 54 times

0

What type of data is indicated to receive the NIB (Bank Identification Number) in a database?

The NIB consists of 21 digits.

I have tried but the following error appears:

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value for column 'NIB' at row 1
  • 1

    Place the structure of the table in question to facilitate the understanding of the exception.

1 answer

5


The error is due to the fact that you are using a numerical type that has no dimension to contain that number.
Moreover, although the NIB consists only of numeric characters, it cannot be represented by a numeric type because it can have digits 0 at the beginning.

So you’ll have to use a guy string.
As the number of characters is constant and known the choice is char(21).

  • Thanks for the clarification !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.