SQL - Decimal out of range

Asked

Viewed 72 times

0

I have a table that represents products in stock, it has a quantity field DECIMAL(5,3), i understood that are 5 digits before the comma and 3 after the comma, up to 2 decimal places before the comma is inserted/updated in the table normally, but from 3 decimal places before the comma starts to issue an error "out of range"as I can store a decimal number with more than 5 digits before the comma?

1 answer

2


DECIMAL(5,3) means that the maximum size is 5, being 3 decimal digits, that is, the maximum value is 99.999.

If you need 5 digits and 3 decimals, then you need 8 digits: DECIMAL(8,3)

See the documentation of mysql: DECIMAL Data Type

Browser other questions tagged

You are not signed in. Login or sign up in order to post.