MySQL Forums :: Docs :: Size of Decimal, version 4.1

Advanced Search

Size of Decimal, version 4.1
Posted by: KimSeong Loh ()
Date: February 13, 2006 08:32PM


It is stated that the size is
* M+2 bytes, if D > 0
* M+1 bytes, if D = 0
* D+2, if M < D

Is the last one correct? of is it D+3?

mysql> create table test (d decimal(0,2));
Query OK, 0 rows affected (0.05 sec)

mysql> show create table test;
| Table | Create Table
| test | CREATE TABLE `test` (
`d` decimal(3,2) default NULL
1 row in set (0.01 sec)

M=0 and D=2, but M is converted to 3 after the table is created,
So, with M=0, D=2, the size should be 4 according to the doc.
But, with M=3, D=2, the size should be 5 according to the doc.

Seems to be some inconsistency, is it supposed to be D+3, if M < D ?

Options: ReplyQuote

Subject Views Written By Posted
Size of Decimal, version 4.1 5434 KimSeong Loh 02/13/2006 08:32PM
Re: Size of Decimal, version 4.1 2352 Stan Segers 02/17/2006 04:56PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.