2

When running a set of insert statements in MySQL I keep getting Error Code: 1264. Out of range value for column 'x' at row 1. The column type is set to float(10, 10) and the values in the column range from 23.912 to 26.458 which are well within the bounds. I have absolutely no idea why I am receiving this error.

ThoseKind
  • 754
  • 2
  • 13
  • 22

2 Answers2

5

float(10,10) means store 10 decimal places, with no space left for the integer component.

0.1234567890 would be valid, because that's 10 decimal places, but 1.234567890 isn't, because you didn't leave any space for the 1.

It's float(total digits, decimal places), and is a sum, not integer places, decimal places.

123.456789 = 9 digits total, 6 for decimals -> float(9, 6)
Marc B
  • 356,200
  • 43
  • 426
  • 500
  • That makes a lot more sense. I didn't understand that the left hand limit was the sum of digits right _and_ left of the decimal, whereas the right hand limit was just the decimal places. Thanks! – ThoseKind Jul 26 '16 at 15:42
0

For your values 23.912 to 26.458, float(10, 10) can't work. Description:-

In float first 10 says you can enter 10 digit in this field and second 10 says 10 digit after (.)

So in this fields you can insert:-

0.111111111
.
.
.
0.999999999

But you can't:-

1.111111111
.
.
.
.
.
111111111.1
Rakesh Kumar
  • 4,319
  • 2
  • 17
  • 30