458,208 Members | 1,456 Online Need help? Post your question and get tips & solutions from a community of 458,208 IT Pros & Developers. It's quick & easy.

# Decimal precision

 P: n/a 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 Replies

 P: n/a 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

 P: n/a 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

 P: n/a "Vamsi"

### This discussion thread is closed

Replies have been disabled for this discussion. 