Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Error : Type mismatch: cannot convert from int to BigDecimal

Hi,
I am working with an Oracle database and number column are translated to BigDecimal in java. But I always have a type mismatch.
Is there a workaround ? Besides, the number column is the PK and is loaded with an oracle sequence.
Thanks,
Jean Marie

Labels (4)
17 Replies
Anonymous
Not applicable

Hello
Convert int to BigDecimal, try(for example, int id)
new BigDecimal(Integer.toString(row1.id))

Best regards
shong
Anonymous
Not applicable

I might put this as bug because the bigdecimal type is used by default when i retrieve a schema from oracle in the metadata repository.
So my workaround id to change the type from bigDecimal to long for each table in the repository.
Jean Marie
Anonymous
Not applicable

Hello
I might put this as bug because the bigdecimal type is used by default when i retrieve a schema from oracle in the metadata repository

What's the data type in your table? number?numeric?decimal?
Best regards

shong
Anonymous
Not applicable

I think the systematic use of bigDecimal to translate Oracle number is not good.
There should be a test and if the precision is 0, then use int|Integer or bigInteger.
Anonymous
Not applicable

Hi Evrybody,
Shong, i think that is a serious problem, cause it gnenrates a java exception , and we can't do any thing sure at our level.
The solution i tried is to get the number type as long type (modifying the BigDecimal type in the Tmap), But some unexpected behaviour can occurs.
Best regards
Anonymous
Not applicable

Hi
J've the same problem :
- the datatype of Oracle column is INTEGER
- the datatype (DB TYpe) in Talend schema is NUMBER
Why not INTEGER ?
- the java type in Talend is BigDecimal
Note:
In TOS 2.3 it was: INTEGER->NUMBER-> Long
Expected, for me, is: INTEGER->INTEGER-> Int
Any solution ?
Best Regards
msosmo
Anonymous
Not applicable

Hi
Anybody has seen this problem ?
msomso
Anonymous
Not applicable

Same issue for me, automatic mapping of NUMBER to BigDecimal is not such a good idea.
Especially since NUMBER without precision is heavily used in a good number of oracle data model design as a datatype for the "id" primary key column of tables.
So I will try to modify the Oracle mapping file . It can be accessed via Windows > preferences >Talend > metadata of TalendType.
The file is pretty self explanatory and specifies the allowed and default mappings for both ways : dbToTalend and talendToDb and both languages : java and perl.
But Alexandre is right, Talend shoud have a way to detect if precision and length are provided in the oracle NUMBER datatype and then map accordingly.
Hope it helps.
David.
Anonymous
Not applicable

Hi,
J think J wasn't clear: the problem occurs before the "mapping file" translation.
I work with the INTEGER database columns, and they appear as NUMBER in Talend when the schema based on the table is generated.
Next it, the translation NUMBER -> BigDecimal seems be ok for me.
J think it is a bug, but how can it be rounded ?
Regards
msomso