×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

I am getting garbage when inserting values into table type decimal

I am getting garbage when inserting values into table type decimal

I am getting garbage when inserting values into table type decimal

(OP)
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  
 

RE: I am getting garbage when inserting values into table type decimal

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)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close