Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: ejonesOriginally posted by: gabygyy
hi,
1.
i'm trying to write some data into an orcale table and the data is not inserted as expected
the logic is:
step1 read an xls files as unicode
step2 using a configuration table and change metadata i give to every column the desired data type(for eg: if in the configuration table type is varchar2 then the type is string, for number type is double)
step3 adapted result from step2 is inserted without errors in the table
After checking the result in the table i see that values from table like
1373697122130450793
is inserted like this
1,37369712213045E18
Thanks. Interesting question. I' curious what this number represents. Are you really doing something where you need that many digits?
For a double, there is really no difference between these two representations of the same number. This shows the limitation of the double datatype most often used for representing floating point numbers in all software. You can read about all the details of how this type works here,
https://en.wikipedia.org/wiki/Double...g-point_format
The double gives you 15 to 17 "significant decimal digits precision". It looks to me like it is performing as expected because the first 15 digits of the two numbers are exactly the same. Any representation of a real number is an approximation and will have limits. And usually 15 digits is much more accuracy than required.
A long datatype gives you a few more digits but depending on what you are needing, it might not work. But you are right up near the limit of what it can do for you. So what is the use case?
Originally posted by: gabygyy
2.
same input data i want to write in to an output file and the data is writen with the power of E
I 'am aware of the function format("%0.0F",field) but the data has around 100 columns and on these columns we have also null values. The format function return error if the field is null.
For writing the data i'm using a filter node in which i have a strcat with all the columns concatenated.
if the input is customerid type double 1932476965.0
when existing from filter node has value echo "1.93248e+09
Please help me with the two cases!
So your current code is probably this:
emit format("%0.0F",field) as "Field Name"
To deal correctly with nulls you can change it to this:
emit (if field.isNull() then str(null) else format("%0.0F",field)) as "Field Name"