By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,215 Members | 1,920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,215 IT Pros & Developers. It's quick & easy.

Double datatype value display in select statament

P: n/a
Hey All,

I have a small problem. consider the following
db2 "create table ttt (mynum float, yournum double )" DB20000I The SQL command completed successfully.
db2 "describe table ttt"
Column Type Type
name schema name Length
Scale Nulls
------------------------------ --------- ------------------ --------
----- -----
MYNUM SYSIBM DOUBLE 8
0 Yes
YOURNUM SYSIBM DOUBLE 8
0 Yes

2 record(s) selected.
db2 "insert into ttt values (1234567890.123456, 1234567890.123456)" DB20000I The SQL command completed successfully.
db2 "select mynum, yournum from ttt" #(QUERY 1)
MYNUM YOURNUM
------------------------ ------------------------
+1.23456789012346E+009 +1.23456789012346E+009

1 record(s) selected.
db2 "select decimal(mynum, 17,6), decimal(yournum, 17,6) from ttt"

#(QUERY 2)

1 2
------------------- -------------------
1234567890.123456 1234567890.123456

1 record(s) selected.
Now, the displayed values from the simple select, and the decimal()
based select, are not the same, although mathematically they both are
the same (I am not good at maths, so I will speak of them as SAME.
some of you extreme mathematicians may not agree with me!!). I want to
display the result of query number 2 by running query number 1, i.e.
by NOT using any math function on the table columns, and still be able
display the actual *numbers* of the columns. How is it possible in
DB2. I am running DB2 UDB 7.2 FP7 on a Windows Platform.

Thanks,
dotyet
Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.