Problem with "/ by zero"

I am trying to divide the value of one column ($in.0._2012_Buildings_Local_Ccy) by the value in another ($in.0.USD_ROE) but I am running into the “/ by zero” error message. The reason for the division is to translate non-USD values into their USD equivalents.

Although most of the “$in.0.USD_ROE” values are 1 (or greater than 1), some of the values in this column are less than 1 (e.g. 0.646, 0.7994) and I wonder whether that’s why I’m seeing the “/ by zero” message?

I’ve tried various approaches but none seem to fix the problem, for example:
$out.0.buildings_value = round(nvl($in.0._2012_Buildings_Local_Ccy,0/$in.0.USD_ROE));

$out.0.buildings_value = (nvl($in.0._2012_Buildings_Local_Ccy,0/$in.0.USD_ROE));

$out.0.buildings_value = round(nvl($in.0._2012_Buildings_Local_Ccy,0)/$in.0.USD_ROE);

$out.0.buildings_value = ($in.0._2012_Buildings_Local_Ccy/$in.0.USD_ROE); (in this case I get an “unexpected null value” message instead of the “/ by zero” message).

Both columns are defined as “long”.

Could someone please tell me the correct expression to divide by a number that’s greater than 0 but less than 1.

Thanks,

Loretta

Hi Loretta,

If data types are “long”, then when data are read it is automatically rounded to “long” data type (which is integer number - so no digits after decimal point). Then 0.456 is rounded to 0 which causes problems with dividing.

Change “long” in metadata to “decimal” or “number” will solve your issue. See http://doc.cloveretl.com/documentation/ … types.html for details.

See edge debug possibility to see actual data going to transformer: http://doc.cloveretl.com/documentation/ … edges.html

Hi Jaroslav,

Thank you for the very clear explanation.

Best regards,

Loretta