Inside my program, I use OCI_ColumnGetScale to identify OCI_CDT_NUMERIC
is Double or Integer.
If the scale > 0, i use the
double d = OCI_GetDouble(rs, index);
else
int i = OCI_GetInt(rs, index);
From the above statement, i expect the scale is 2.
but it return 0 for OCI_ColumnGetScale.
Is this a bug or how to identify the column is double or integer for
TO_NUMBER() ?
Thank
Alvin Teh
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What is your version of Oracle (scale and precision values differs depending
the version of oracle) ?
I'll test your code this evening and check the real values retrieved form OCI.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Vincent,
select to_number('$99.64', 'L99D99') from dual
Inside my program, I use OCI_ColumnGetScale to identify OCI_CDT_NUMERIC
is Double or Integer.
If the scale > 0, i use the
double d = OCI_GetDouble(rs, index);
else
int i = OCI_GetInt(rs, index);
From the above statement, i expect the scale is 2.
but it return 0 for OCI_ColumnGetScale.
Is this a bug or how to identify the column is double or integer for
TO_NUMBER() ?
Thank
Alvin Teh
What is your version of Oracle (scale and precision values differs depending
the version of oracle) ?
I'll test your code this evening and check the real values retrieved form OCI.
to_number() returns a "NUMBER" with no precision on its scale or precision.
Here is the definition from Oracle of a the type NUMBER with no precision /
scale :
Thus to_number() is returning a NUMBER and not a "specialised" version of a
NUMBER depending on the given format.
OCILIB retrieves form OCI client is this case 0 for scale and 0 for precision.
It is not possible to find out the "range" of the value contained inside a
NUMBER as NUMBER allows all possible values.
Regards,
Vincent
Thank a lot.
You are correct, the oracle oci didn't provide scale for compute field ( eg:
avg,min,max,to_number..).
I will handle it on my program.
Regards,
Alvin Teh