473,503 Members | 3,721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Decimal precision

Hi,
I have a column defined as decimal(4,3).
I get the following error when I try to insert "12.50000000000000"

[IBM][CLI Driver] CLI0111E Numeric value out of range. SQLSTATE=22003
sqlstate = 22003

I even tried with "12.500" and "12.50" , but still get the same error.

My point here is, it allows only one number before the decimal point.
It allows "1.50000000000"

Any help would be appreciated.

Thanks.

Aug 14 '06 #1
3 41607
Vamsi wrote:
Hi,
I have a column defined as decimal(4,3).
I get the following error when I try to insert "12.50000000000000"

[IBM][CLI Driver] CLI0111E Numeric value out of range. SQLSTATE=22003
sqlstate = 22003

I even tried with "12.500" and "12.50" , but still get the same error.

My point here is, it allows only one number before the decimal point.
It allows "1.50000000000"

Any help would be appreciated.

Thanks.
>From the documentation:
"The position of the decimal point is determined by the precision and
the scale of the number. The scale, which is the number of digits in
the fractional part of the number, cannot be negative or greater than
the precision. The maximum precision is 31 digits."

That means:

Total digits: First number
Digits before fixed-point: First number - Second number.
Digits after fixed-point: Second number.

So, to accept "12.50000000000000", the declaration would have to be:
DECIMAL(16,14).

B.

Aug 14 '06 #2
Thanks for the quick reply Brian, I think declaring DECIMAL(5,3) should
solve my problem.
Brian Tkatch wrote:
Vamsi wrote:
Hi,
I have a column defined as decimal(4,3).
I get the following error when I try to insert "12.50000000000000"

[IBM][CLI Driver] CLI0111E Numeric value out of range. SQLSTATE=22003
sqlstate = 22003

I even tried with "12.500" and "12.50" , but still get the same error.

My point here is, it allows only one number before the decimal point.
It allows "1.50000000000"

Any help would be appreciated.

Thanks.
From the documentation:

"The position of the decimal point is determined by the precision and
the scale of the number. The scale, which is the number of digits in
the fractional part of the number, cannot be negative or greater than
the precision. The maximum precision is 31 digits."

That means:

Total digits: First number
Digits before fixed-point: First number - Second number.
Digits after fixed-point: Second number.

So, to accept "12.50000000000000", the declaration would have to be:
DECIMAL(16,14).

B.
Aug 14 '06 #3
"Vamsi" <va****@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Thanks for the quick reply Brian, I think declaring DECIMAL(5,3) should
solve my problem.
Besides the fact that you need 2 significant digits to the left of the
decimal point, using DECIMAL(5,3) takes the same amount of space internally
within DB2 (3 bytes) as DECIMAL(4,3) so it is usually prudent to round up to
the next highest odd number if the precision is an even number.
Aug 14 '06 #4

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

Similar topics

21
4492
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
2
6489
by: Piotr | last post by:
Hi I'm working with Datagrid containg decimal (editable) numbers. The user-entered numbers are read by decimal.Parse() method. However, Datagrid formats some decimals as "1", but some as (eg)...
2
1593
by: saarcarmi | last post by:
Hi Could anyone help me to understand why in the following code sum1 is different from sum2? Basically it's the same calculation done. Keep in mind the x is 28 digits so it's within the range...
2
4288
by: Sam | last post by:
Hi, I would like to be able to read the scale & precision of a decimal type contained in a sql server table from vb.net. I would like to set some properties (like width,format) of a gridview's...
0
1135
by: MomentisMan | last post by:
I have an app with a MySQL backend and MS-Access frontend. I have a table on the database (tblTime) with three Decimal columns. When I connect to the table through ODBC in Access, the precision...
0
1252
by: MomentisMan | last post by:
I have an app with a MySQL backend and MS-Access frontend. I have a table on the database (tblTime) with three Decimal columns. When I connect to the table through ODBC in Access, the precision...
6
14580
by: billelev | last post by:
I have the following field in a query: Quantity: Sum(.*) Where is a decimal, such as 100 or 100.23 etc. and is either -1 or +1. In the source tables, both fields are defined as type...
4
8125
by: apellerin | last post by:
I am having an issue where I need to multiply a double value by a value with four decimal places within a calc field. However, it will only allow me to multiply by a whole number. "Invalid...
0
7192
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
7064
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
7261
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,...
0
5559
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4665
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1492
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.