473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Very basic formatting question

Using db2 CLP I am trying to get the following SQL statement to
display "0.33". But, as you can see, it doesn't.

db2 =select round(float(1) / 3, 2) from sysibm.sysdummy1

1
------------------------
+3.30000000000000E-001

1 record(s) selected.

What on earth am I doing wrong?

Thanks,

\M

Jul 24 '07 #1
2 3500
Desmodromic wrote:
Using db2 CLP I am trying to get the following SQL statement to
display "0.33". But, as you can see, it doesn't.

db2 =select round(float(1) / 3, 2) from sysibm.sysdummy1

1
------------------------
+3.30000000000000E-001

1 record(s) selected.
Try casting to DECIMAL.
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jul 24 '07 #2
On Tue, 24 Jul 2007 02:29:10 -0700, Desmodromic
<da*******@yahoo.com.auwrote:
>Using db2 CLP I am trying to get the following SQL statement to
display "0.33". But, as you can see, it doesn't.

db2 =select round(float(1) / 3, 2) from sysibm.sysdummy1

1
------------------------
+3.30000000000000E-001

1 record(s) selected.

What on earth am I doing wrong?

Thanks,

\M
What are you doing wrong? You are assuming that ROUND() chops off the
rounded zeros. It does indeed round them, it does not, however, remove
them.

Way around this is as Serge said, cast it afterwards: select
DECIMAL(round(float(1) / 3, 2), 3,2) from sysibm.sysdummy1

B.
Jul 25 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ray | last post by:
Date problem. Using non American date formats with Microsoft Access and Visual Basic. I set my regional settings to English(Ireland) or English(United Kingdom) and my date appears in Access as...
4
by: Atlas | last post by:
I've almost completed a small project with MS SQL 2000 server in the BE and Access 2003 in the FE. 5 concurrent users, 30 tables, 35 forms and subforms, 13 reports. Not so happy in the beginning...
3
by: Jouke Langhout | last post by:
Hello all! For quite some time now, I've got the following problem: Access won't close properly when a user closes the application. An ACCESS process stays active and that process can only be...
2
by: Colleyville Alan | last post by:
I am using Access and have embedded the ActiveX control Formula One that came with Office 2000. (ver 3.04). I have created and formatted a spreadsheet and now I want to copy the info with...
4
by: DBQueen | last post by:
I have a subform which is in Continuous Forms view. I have added a button to the bottom of the page to move to the next record using the button wizard (result: DoCmd.GoToRecord , , acNext). I...
4
by: hope | last post by:
Hi, How can I format a string field using Data Formatting Expression property in datagrid? For example: format last name from BROWN to Brown. Thanks
3
by: Mario Soto | last post by:
Hi. i hava a postresql 7.4.2 in a production server. tha machine is a Pentium IV 2,6 GHZ AND 1 GB IN RAM with lINUX RH 9.0. The postresql.conf say: ...
2
by: trezraven | last post by:
I am creating a template in Word 2007 using Visual Basic Editor. I am pulling information from an Access database. I know this is probably a stupid question, but for the life of me I can't figure out...
2
by: gozu | last post by:
Here is my query: SELECT departments.department_name AS "Department name", locations.STREET_ADDRESS AS "Mailing address", locations.city, locations.state_province, locations.postal_code FROM...
8
by: Markus Pitha | last post by:
Hello, first of all I have a question about types: When I have a method like this... TYPE getStringValue() { string str = "test"; return str; }
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.