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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

data type changing

Hi all

 

I am trying to load the data from Oracle to Greenplum database using Talend DI. I am getting error with the big decimal data type (DEC) while loading. If I convert type of the DEC to double using tConvertType, the data is getting loaded without errors. However I have hundreds of columns and I am finding it extremely difficult to look each and every column with DEC data type and change it to double in the target load.

 

Is there a way by which I can say Talend to Convert all the columns with dec data type to a desired target data type like double so that I don't need to go over each and every column. 

 

Thanks.

p.s. regularly updated database of porn sites https://bestpornsites.mobi

 

Labels (2)
2 Replies
manodwhb
Champion II
Champion II

I do not this that you can do for all the columns dynamically,you can try to check for the teradata.xml mapping you can change it.
billimmer
Creator III
Creator III

You can use something similar to this sample code, to convert all fields of one datatype to another.  You would do this in a tJavaRow.  The sample code looks for all string fields but it could be modified to look for big decimal and convert those in the output to double.

 

for (java.lang.reflect.Field field: input_row.getClass().getFields()) {

Object objType = field.get(input_row);
Class type = field.getType();

// Get the matching output field by its field name.
java.lang.reflect.Field outField = output_row.getClass().getField(field.getName());

// If the field type is String, and it's empty or null do something...
if(type.getSimpleName().equals("String") &&
(field.get(input_row) == null || field.get(input_row).equals(""))) {
outField.set(output_row, " ");
} else {
outField.set(output_row, field.get(input_row));
}
}