While I was trying to put data into the database, I got this error. I do not understand why it is happening because government_code's type is BIGINT.

ERROR 1366: 1366: Incorrect integer value: '114404139344' 
     for column 'government_code' at row 1
SQL Statement:
INSERT INTO `homestead`.`OfficialAddress` (`id`, `part1`, `part2`, `part3`,
    `government_code`, `is_new`) VALUES ('175099', 'Seoul', 'Mapogu', 
    'Seongam5-gil', '114404139344', '1')

Here is the result of SHOW CREATE TABLE homestead.OfficialAddress;

OfficialAddress, CREATE TABLE `OfficialAddress` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'unique',
  `part1` char(6) NOT NULL COMMENT 'part1',
  `part2` char(35) NOT NULL COMMENT 'part2',
  `part3` char(33) NOT NULL COMMENT 'part3',
  `government_code` bigint(15) NOT NULL COMMENT 'gov_code',
  `is_new` tinyint(1) unsigned NOT NULL COMMENT 'is_new',
  PRIMARY KEY (`id`),
  UNIQUE KEY `id_UNIQUE` (`id`)

Result of SELECT @@global.sql_mode;

  • 1
    Show us the output of SHOW CREATE TABLE homestead.`OfficialAddress` ; – ypercubeᵀᴹ Feb 12 '18 at 13:18
  • Are there are any triggers on the table? What is the sql_mode and what is the mysql version? – ypercubeᵀᴹ Feb 13 '18 at 9:30
  • @ypercubeᵀᴹ I've updated my question with the result of sql_mode and im usign 5.7.20 – smchae Feb 13 '18 at 12:36
  • Do you get the error if you don't put quotes around the integer value? INSERT ... (..., 114404139344, 1); ? – ypercubeᵀᴹ Feb 13 '18 at 13:08
  • @ypercubeᵀᴹ - Quotes around integers, at least in this context, are not an issue. – Rick James Feb 18 '18 at 1:26

The value is far below the maximum limit of BIGINT

BIGINT supports 8 Bytes, Min value -9223372036854775808 Maz value 9223372036854775807

Perhaps while creating the table you made the defualt size to be less?

  • there are some data having larger value than 114404139344. So its not the matter of size, i think. I have inserted about 170k rows but only 3 of them return this error – smchae Feb 13 '18 at 12:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.