Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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));
}
}