# Thread: Number datatype looses decimal places

1. Junior Member
Join Date
Feb 2009
Posts
2

## Number datatype looses decimal places

When a "table input" column is an arithmetic expresion of all NUMBER(18, 2) operands, the result output column is treated as NUMBER(0, 0) and the actual values looses its decimal places. That is, if the result of the arithmetic expresion is 12345678.47 then the output field is recorded as 12345678.00 in the output stream, and so it goes into the "table output" step.

Kettle v3.1
DB postgresql 8.1
System: Centos 5.2

Is there a way of forcing kettle to keep its decimal places, or the tell it that the field has to be NUMBER(18, 2) ?

Thanks,
Gustavo.

2. Junior Member
Join Date
Aug 2007
Posts
10
Got the exact same problem :

1- Extract number from Oracle database with 4 decimal.
2- In a javascript step, make a sum of both of them and get a result with 1 decimal

Kettle 3.1.1
Oracle 10.2.0.4

3. Chief Data Integration
Join Date
Nov 1999
Posts
9,729
A Number is a double precision floating point value.
You guys probably mean the String representation of the value?

4. Junior Member
Join Date
Aug 2007
Posts
10
I am just trying to do this :

Step 1 : Output Step
select
sum(decode(code_indic,'215',reel,0)) NB_LD_T,
sum(decode(code_indic,'193',reel,0)) NB_LD_P
from ...

Step 2 : Javascript Step
NB_LD = NB_LD_P + NB_LD_T

Of course there are other calculations so we do not do it directly in the Output Step.

NB_LD_T and NB_LD_P have 4 decimals
NB_LD gives 1 decimal

Last edited by benoit.colas; 10-29-2009 at 02:47 PM.

5. Junior Member
Join Date
Aug 2007
Posts
10

Quite strange to got this string representation everywhere in preview in Kettle (Spoon) : only 1 decimal displayed whereas values have more decimals.

Adding an Alter step with format number 14, 4 #.##### solve the problem

6. Chief Data Integration
Join Date
Nov 1999
Posts
9,729
File a feature request to add the format mask to the output fields in the JS step. ;-)

7. Junior Member
Join Date
Aug 2007
Posts
10
Posted in JIRA : PDI-2813

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•