Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Pessoal, acho que estou com algum bug no mysql....
Criei uma tabela com um campo decimal(3,3) para poder inserir valores como 123.123..mas não estou conseguindo fazer isso...
Vejam:
mysql> use legendas
Database changed
mysql> show tables;
+--------------------+
| Tables_in_legendas |
+--------------------+
| tbl_legendas |
+--------------------+
1 row in set (0.00 sec)
mysql> insert into tbl_legendas (tempo,legenda) values (25.251,'teste1');
Query OK, 1 row affected, 1 warning (0.02 sec)
mysql> select * from tbl_legendas;
+--------+-------+---------+
| codigo | tempo | legenda |
+--------+-------+---------+
| 221 | 0.999 | teste1 |
+--------+-------+---------+
2 rows in set (0.01 sec)
Observem que eu inseri o valor 25.251 e ele entrou na base como 0.999 ;(
Não sei mais o que fazer,
Se eu mudo o formato para float, numeric, qualquer valor, ele retorna o mesmo problema.
O que está acontecendo???
Valeu
Olá Douglas,
Alterei para 4,3 e mesmo assim tive o mesmo erro.
mysql> desc tbl_legendas;
+---------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+----------------+
| codigo | bigint(20) | NO | PRI | NULL | auto_increment |
| tempo | decimal(4,3) | NO | | NULL | |
| legenda | varchar(255) | NO | | NULL | |
+---------+--------------+------+-----+---------+----------------+
3 rows in set (0.02 sec)
mysql> insert into tbl_legendas (tempo,legenda) values (25.251,'teste1');
ERROR 1264 (22003): Out of range value for column 'tempo' at row 1
mysql> select * from tbl_legendas;
+--------+-------+---------+
| codigo | tempo | legenda |
+--------+-------+---------+
| 218 | 0.999 | oi |
| 221 | 0.999 | teste1 |
| 222 | 0.999 | teste1 |
| 223 | 0.999 | teste1 |
+--------+-------+---------+
4 rows in set (0.00 sec)
O que será que pode ser isso???
To totalmente sem ideia....
Fiz uns testes aqui decimal(5,3) funcionou.
Altere o formato para Decimal(4,3)
http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html
http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html