I have a column called closing_price
which is DECIMAL(6,2)
. My understanding is that this means it can take 6 digits and 2 decimal places, so the largest number that could fit in this column would be 999999.99
.
However, I am getting this error now:
Numeric value out of range: 1264 Out of range value for column 'closing_price' at row 1 (SQL: insert into `stock_history` (`date`, `closing_price`, `stock_id`, `updated_at`, `created_at`) values (2000-02-01, 51900.000000, 214, 2020-02-07 09:51:03, 2020-02-07 09:51:03))
I don't understand how this could fall out of range of DECIMAL(6,2)
. Please correct me if my understanding is wrong, or help me troubleshoot this if I am right.
I don't know why the number 51900 is showing zeros for 6 decimal places. I am getting these values from an API and a lot of them have up to 6 zeros at the end, but this is the first one that threw and error after over a million inserts.