I set quantity, price, total datatype be decimal(10,2) in mysql

When I insert 2, 12, 24 to that table, it shows Data truncated for column 'quantity' at row 1.

Why is it?

    Roger Ramjet;10894987 wrote:

    because 2 is an integer not a decimal.

    But that doesn't require truncation. I'm confused, I get no such error from pgsql doing this.

    Techissue2008, just FYI, decimal / numeric types are exact types, while floating points are inexact / approximation types. i.e. 1.111 may not get stored as exactly that, but 1.11099999 or something like that.

      Write a Reply...