cannot convert int to bigdecimal

One Star

cannot convert int to bigdecimal

DB: SQL Server
I am using tMap component to transform data from source to Destination in SQL Server.
Its throwing the error as "Type mismatch: cannot convert from int to BigDecimal"
Any help on achiving this?
Thanks,
-Teja
One Star

Re: cannot convert int to bigdecimal

may be you are trying to convert (or assigning) an INT to BigDecimal. check your schema.
or else post a scr shot of your job.
One Star

Re: cannot convert int to bigdecimal

in the image I can see that "fieldnumber" 2nd column is wrongly mapped... in the input schema you mapped it to int and in the ouput schema it is BigDecimal.
check that
Seventeen Stars

Re: cannot convert int to bigdecimal

hi,
I think you cannot cast a 'int' value into bigdecimal implicitlty .
Try and use java method : public BigDecimal(int val)
regards
laurent
One Star

Re: cannot convert int to bigdecimal

Hi!
I have the same problem as him...
I have a BigDecimal 'BPP_TYPE' in my table (row1), that I want to test :
=> If it is equal to 1, I will write "Physique" instead
=> If it is not (0 or NULL), I will write "Morale"
So, I switch from BigDecimal (row1) to String (output of my tmap)
In my tmap, I first had the following expression in the Var field :
row1.BPP_TYPE==1?"Physique":"Morale"
Obviously it doesn't work, so I changed it to :
row1.BPP_TYPE==BigDecimal(1)?"Physique":"Morale"
That doesn't work neither...
My problem is that I don't know how to import/create java methods (as BigDecimal(int)) in my job... Any Help? Thanks!
One Star

Re: cannot convert int to bigdecimal

In this case try to use tConvertType before pointing the source (you can't convert ) into tMap.
tConvertType converts your colums automatically (by setting the option in components properties) and lets you change data types in a flow.
One Star

Re: cannot convert int to bigdecimal

...or just use the entry below and modify it for your field to be converted in tMap:
new BigDecimal(Integer.toString(yourInputRow.yourField))
One Star

Re: cannot convert int to bigdecimal

Hi again!
I solved my problem, changing the preferences of Talend (Window>Preferences).
I changed the xml file of Oracle mapping, allowing number cast to integer et not BigDecimal... It is so much easier to do any modification then!
I followed this exemple, "V. Définir les types de variables" (in French sorry...) :
http://jsdarges.developpez.com/tutoriels/bi/bien-debuter-projet-talend/
Six Stars

Re: cannot convert int to bigdecimal

Justine,
Could you show us what you did? I have a similar issue -- I am getting Java error converting an MS SQL identity column to an INT...
Cheers.