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`)
) ENGINE=InnoDB AUTO_INCREMENT=175491 DEFAULT CHARSET=utf8

Result of SELECT @@global.sql_mode;

ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
  • 1
    Show us the output of SHOW CREATE TABLE homestead.`OfficialAddress` ; – ypercubeᵀᴹ Feb 12 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 at 9:30
  • @ypercubeᵀᴹ I've updated my question with the result of sql_mode and im usign 5.7.20 – smchae Feb 13 at 12:36
  • Do you get the error if you don't put quotes around the integer value? INSERT ... (..., 114404139344, 1); ? – ypercubeᵀᴹ Feb 13 at 13:08
  • @ypercubeᵀᴹ - Quotes around integers, at least in this context, are not an issue. – Rick James Feb 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 at 12:46

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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