
Specialist III
2014-03-25
01:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BigDecimal to integer conversion
Hi,
I'm super new to Talend and am running into a problem while extracting data from an oracle database and loading it into a postgres db. I have a few columns that have use the oracle bigDecimal datatype without a precision. To me that meant that its a just a large integer (double) - the postgres db has the equivalent column using an integer datatype. When I try to directly move data through tMap I get an bigDecimal to integer conversion error.
In Java, I know we would use bigDecimalVar.intValue() to convert the bigDecimal into an integer. How do I implement this in tMap? I tried using the bigDecimalColumn.intValue() in the expression box but I get a Java lang error.
Help!
Thanks!
I'm super new to Talend and am running into a problem while extracting data from an oracle database and loading it into a postgres db. I have a few columns that have use the oracle bigDecimal datatype without a precision. To me that meant that its a just a large integer (double) - the postgres db has the equivalent column using an integer datatype. When I try to directly move data through tMap I get an bigDecimal to integer conversion error.
In Java, I know we would use bigDecimalVar.intValue() to convert the bigDecimal into an integer. How do I implement this in tMap? I tried using the bigDecimalColumn.intValue() in the expression box but I get a Java lang error.
Help!
Thanks!
1,848 Views
7 Replies

Specialist III
2014-03-25
01:44 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is the expression I'm trying to use:
row1.DS_PRS_ID.intValue()
row1.DS_PRS_ID.intValue()
1,848 Views

Anonymous
Not applicable
2014-03-25
04:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you get an Java compilation error this way than at first I would check if I get REAL a BigDecimal as object type.
Could you provide the error message?
Could you provide the error message?
1,848 Views

Anonymous
Not applicable
2015-04-17
08:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello all,
i want to convert BigDecimal to integer ,
I am using Integer.parseInt(row.columnname)
but its not working........
please provide solution for this.
i want to convert BigDecimal to integer ,
I am using Integer.parseInt(row.columnname)
but its not working........
please provide solution for this.
1,848 Views

Anonymous
Not applicable
2015-04-17
08:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi indra,
intValue() convert the big decimal to integer
row3.test.intValue()
Regards,
kumar
intValue() convert the big decimal to integer
row3.test.intValue()
Regards,
kumar
1,848 Views

Specialist III
2016-12-13
11:12 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello all,
i want to convert BigDecimal to integer ,
I am using Integer.parseInt(row.columnname)
but its not working........
please provide solution for this.
1,848 Views

Anonymous
Not applicable
2016-12-14
04:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi prudvi,
Have you tried to use
row1.newColumn.intValue() //The type of newColumn is BigDecimal.
Best regards
Sabrina
Have you tried to use
row1.newColumn.intValue() //The type of newColumn is BigDecimal.
Best regards
Sabrina
1,848 Views

Contributor
2022-02-17
11:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
This topic is quite old but I will answer it because people (like me) may look for an answer and find this topic.
Here is the solution I found : you can make a routine such as :
public static Integer Integer(BigDecimal bd) {
return bd.intValue();
}
Then you can call this routine in Tmap or anywhere you need to convert Bigdecimal to Integer by typing {Routine_Name}.Integer({BigDecimal_Value})
Make sure the BigDecimal number you want to convert is convertible to Integer tho.
I'm quite new on Talend so maybe there is a better solution, but Routine is a very powerful tool that can solve many problems.
Cheers
1,848 Views
