Subject Re: [ib-support] error in dnvl udf (fbudf)
Author Milan Babuskov
Ernesto Cullen wrote:
>>Ernesto Cullen wrote:
>>
>>>And another question: if the ImporteTotal field were Numeric(18,6),
>>
>> > do I have to use dnvl, invl or i64nvl?
>>
>>I think i64nvl... have you tried it?
>>This is probably why you got wrong result with DNVL.
>>
>
>
> does the numeric(18,2) gets stored as int64? I thought that was true only
> when you have more than 4 decimals...
> I tried using I64NVL, and get something promising: instead of 605 i got
> 60500 -It seems that i have to scale the result myself. I tried again with
> the field defined as numeric(18,6) and get 6 zeros, so that seems to be the
> case.

AFAIK, all (18,x) datatypes are stored as int64. Maybe the connection
library you're using doesn't recognize it. What do you use to access the
database?

You can try to cast the result to double precision to see if that is the
case, for example:

select DNVL(cast(Sum(ImporteTotal),0) as double precision) from pagos

I'm not an expert on this, so someone else may give you the full
explanation.

Milan.