Subject | Re: [ib-support] Data types |
---|---|
Author | Ann W. Harrison |
Post date | 2002-10-03T15:51:59Z |
At 07:45 PM 10/2/2002 -0400, Jonathan M. Freedman wrote:
int (5-9), or 64-bit int (10-18). Larger would be
represented as double. But here's the catch. Numeric
and decimal are scaled, meaning that part of the column
definition is the power of 10 by which the stored value
must be multiplied to get the intended value. For
example, if you assign 123.456 (123,456 for those who
didn't go to school in the US) to a numeric (9, 3)
column, what is stored is 123456. The column definition
includes a scale of -3, so the database considers the
value to be 123456 * .001.
The scaled integer is a nuisance for C programmers
(among others... I think only COBOL knows about that
type intrinsically) because you have to pass the scale
as well as the value to your UDF or program. But then,
you should be passing a descriptor in any case, since
that's the only way to handle nulls.
Regards,
Ann
www.ibphoenix.com
We have answers.
>I have noted several new data types...i am trying to pass all the differentVaries with the C compiler - it's a 64-bit integer.
>number types to a UDF I am developing that rounds the variables to a user
>defined level.
>biginteger---------------> ?
>numeric------------------> ?Depending on the precision it may be short int (1-4),
>decimal-------------------> ?
int (5-9), or 64-bit int (10-18). Larger would be
represented as double. But here's the catch. Numeric
and decimal are scaled, meaning that part of the column
definition is the power of 10 by which the stored value
must be multiplied to get the intended value. For
example, if you assign 123.456 (123,456 for those who
didn't go to school in the US) to a numeric (9, 3)
column, what is stored is 123456. The column definition
includes a scale of -3, so the database considers the
value to be 123456 * .001.
The scaled integer is a nuisance for C programmers
(among others... I think only COBOL knows about that
type intrinsically) because you have to pass the scale
as well as the value to your UDF or program. But then,
you should be passing a descriptor in any case, since
that's the only way to handle nulls.
Regards,
Ann
www.ibphoenix.com
We have answers.