1 | mysql> create table abc (value decimal(31,0) not null);
|
---|
2 | Query OK, 0 rows affected (0.13 sec)
|
---|
3 |
|
---|
4 | mysql> insert into abc values (1);insert into abc values (12);insert into abc values (123);insert into abc values (1234);insert into abc values (12345);insert into abc values (123456);insert into abc values (1234567);insert into abc values (12345678);insert into abc values (123456789);insert into abc values (1234567890);insert into abc values (12345678901);insert into abc values (123456789012);insert into abc values (1234567890123);insert into abc values (12345678901234);insert into abc values (123456789012345);insert into abc values (1234567890123456);insert into abc values (12345678901234567);insert into abc values (123456789012345678);insert into abc values (1234567890123456789);insert into abc values (12345678901234567890);insert into abc values (123456789012345678901);insert into abc values (1234567890123456789012);insert into abc values (12345678901234567890123);insert into abc values (123456789012345678901234);insert into abc values (1234567890123456789012345);insert into abc values (12345678901234567890123456);insert into abc values (123456789012345678901234567);insert into abc values (1234567890123456789012345678);insert into abc values (12345678901234567890123456789);insert into abc values (123456789012345678901234567890);
|
---|
5 |
|
---|
6 | mysql> select * from abc where value = '12345678901234567';
|
---|
7 | +-------------------+
|
---|
8 | | value |
|
---|
9 | +-------------------+
|
---|
10 | | 12345678901234567 |
|
---|
11 | +-------------------+
|
---|
12 | 1 row in set (0.00 sec)
|
---|
13 |
|
---|
14 | mysql> select * from abc where value = '123456789012345678';
|
---|
15 | Empty set (0.00 sec)
|
---|
16 |
|
---|
17 | mysql> select * from abc where value = '1234567890123456789';
|
---|
18 | Empty set (0.00 sec)
|
---|
19 |
|
---|
20 | mysql> select * from abc where value = '12345678901234567890';
|
---|
21 | Empty set (0.00 sec)
|
---|
22 |
|
---|
23 | mysql> select * from abc where value = '123456789012345678901';
|
---|
24 | +-----------------------+
|
---|
25 | | value |
|
---|
26 | +-----------------------+
|
---|
27 | | 123456789012345678901 |
|
---|
28 | +-----------------------+
|
---|
29 | 1 row in set (0.00 sec)
|
---|
30 |
|
---|
31 | mysql> alter table abc add index (value);
|
---|
32 | Query OK, 30 rows affected (0.08 sec)
|
---|
33 | Records: 30 Duplicates: 0 Warnings: 0
|
---|
34 |
|
---|
35 | mysql> select * from abc where value = cast('12345678901234567890' as decimal(31,0));
|
---|
36 | +----------------------+
|
---|
37 | | value |
|
---|
38 | +----------------------+
|
---|
39 | | 12345678901234567890 |
|
---|
40 | +----------------------+
|
---|
41 | 1 row in set, 1 warning (0.00 sec)
|
---|
42 |
|
---|
43 | mysql> show warnings;
|
---|
44 | +-------+------+---------------------------------------+
|
---|
45 | | Level | Code | Message |
|
---|
46 | +-------+------+---------------------------------------+
|
---|
47 | | Error | 1292 | Truncated incorrect DECIMAL value: '' |
|
---|
48 | +-------+------+---------------------------------------+
|
---|
49 | 1 row in set (0.00 sec)
|
---|
50 |
|
---|
51 | mysql> truncate abc;
|
---|
52 | Query OK, 0 rows affected (0.00 sec)
|
---|
53 |
|
---|
54 | mysql> insert into abc values (12345678901234567890);
|
---|
55 | Query OK, 1 row affected (0.00 sec)
|
---|
56 |
|
---|
57 | mysql> select * from abc where value = '12345678901234567890';
|
---|
58 | Empty set (0.00 sec)
|
---|
59 |
|
---|
60 | mysql> select * from abc where value = 12345678901234567890;
|
---|
61 | +----------------------+
|
---|
62 | | value |
|
---|
63 | +----------------------+
|
---|
64 | | 12345678901234567890 |
|
---|
65 | +----------------------+
|
---|
66 | 1 row in set (0.00 sec)
|
---|
67 |
|
---|
68 | mysql> select * from abc where value = cast('12345678901234567890' as decimal(31,0));
|
---|
69 | +----------------------+
|
---|
70 | | value |
|
---|
71 | +----------------------+
|
---|
72 | | 12345678901234567890 |
|
---|
73 | +----------------------+
|
---|
74 | 1 row in set (0.01 sec)
|
---|
75 |
|
---|
76 | mysql> insert into abc values (1);
|
---|
77 | Query OK, 1 row affected (0.00 sec)
|
---|
78 |
|
---|
79 | mysql> select * from abc where value = cast('12345678901234567890' as decimal(31,0));
|
---|
80 | +----------------------+
|
---|
81 | | value |
|
---|
82 | +----------------------+
|
---|
83 | | 12345678901234567890 |
|
---|
84 | +----------------------+
|
---|
85 | 1 row in set, 1 warning (0.00 sec)
|
---|
86 |
|
---|
87 | mysql> show warnings;
|
---|
88 | +-------+------+---------------------------------------+
|
---|
89 | | Level | Code | Message |
|
---|
90 | +-------+------+---------------------------------------+
|
---|
91 | | Error | 1292 | Truncated incorrect DECIMAL value: '' |
|
---|
92 | +-------+------+---------------------------------------+
|
---|
93 | 1 row in set (0.00 sec)
|
---|
94 |
|
---|