Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am getting garbage when inserting values into table type decimal

Status
Not open for further replies.

roman987

Programmer
Aug 28, 2000
5
US
i created table with 2 column type decimal(16,4) and double

when I insert values into that table I get garbage. can some one help me to understand why I am getting garbage. Here is my code.

mysql> create table roman( a double(16,4), b decimal(16,4) );
Query OK, 0 rows affected (0.01 sec)

mysql> insert into roman values(12.2,40.3);
Query OK, 1 row affected (0.05 sec)

mysql> select * from roman;
+--------------------+------------------+
| a | b |
+--------------------+------------------+
| 190359826455422719014202781144712880322016387120297010110046519028527894956257
32743213763196815586366749275297927955172219667069187668495131196738368218736857
6768372755275862566106038272.0000 | 99999999999.9999 |
+------------------------------------------------------------------------------+------------------+
1 row in set (0.00 sec)

----------------------------------
why am I gettin those garbage values instead of the one I inserted .
Thank You.
Roman987@aol.com
 
Dunno, it worked fine for me. I just pasted your exact commands from this page to my system and got:

mysql> create table roman( a double(16,4), b decimal(16,4) );
Query OK, 0 rows affected (0.02 sec)

mysql> show tables;
+----------------+
| Tables in rick |
+----------------+
| djpim |
| roman |
+----------------+
2 rows in set (0.00 sec)

mysql> insert into roman values(12.2,40.3);
Query OK, 1 row affected (0.02 sec)

mysql> select * from roman;
+---------+---------+
| a | b |
+---------+---------+
| 12.2000 | 40.3000 |
+---------+---------+
1 row in set (0.01 sec)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top