ThoseKind ThoseKind - 4 months ago 7
SQL Question

Strange 1264 Out of Range Error

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.

Answer

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)