Subject Re: SOLUTION: [firebird-support] Arithmetic exception e.t.c. after reinstallation
Author Radovan Bukoci
Radovan Bukoci wrote / napísal (a):

>Helen Borrie wrote / napísal (a):
>
>
>
>>At 11:13 AM 24/02/2005 +0100, you wrote:
>>
>>
>>
>>
>>
>>>Hello,
>>>
>>>I have performed this:
>>>- backed up my DB
>>>- reinstalled FB 1.5.2 on 1.5.0 (both SS, on linux Slackware 10. The
>>>1.5.0 was backed up by installation program)
>>>- I copied my own library udf_nd.so to the new installation (contains
>>>several functions, e.g. TS_FMT)
>>>- restored the DB
>>>
>>>Now, when I perform
>>>select '02/14/2005', ts_fmt('02/14/2005', '%Y-%m') from rdb$database;
>>>I get the error
>>>"arithmetic exception, numeric overflow, or string truncation"
>>>
>>>Please help me, what could be wrong ?
>>>
>>>
>>>
>>>
>>Well, the engine has no idea what data type or column name to return in the
>>second field.
>>
>>Try supplying a CAST expression and a column name, e.g.
>>
>>select
>> '02/14/2005',
>> CAST(ts_fmt('02/14/2005', '%Y-%m') AS CHAR(5)) AS field2
>>
>>
>>from rdb$database;
>
>
>>
>>
>>
>>
>Thank you, but it throws the same exception. However, this select was
>just an example, here is the real one:
>
>SELECT TS_FMT(DatumZP,'%Y-%m') AS Usek , sum(CenaNetA) as Vystup1,
>sum(CenaNetB) as Vystup2 FROM OdbFak GROUP BY TS_FMT(DatumZP,'%Y-%m')
>
>and this was working prior to the reinstallation, so I wonder where else
>may be error. Now I tried with the old DB file, throws the same error.
>So it is either bug in (my instance of) FB 1.5.2 (which was not in
>1.5.0). I don't know what may be the problem. Could I ommit to copy some
>files or settings ?
>
>
Don't know if anybody's interested, but I found solution:

My function ts_fmt was originally declared as:

DECLARE EXTERNAL FUNCTION ts_fmt
TIMESTAMP, CSTRING(40)
RETURNS VARCHAR(40)
ENTRY_POINT 'ts_fmt' MODULE_NAME 'udf-nd';

and problem was in the VARCHAR(40) - it's no more working (for me) in
1.5.1 and 1.5.2.
After changing to CSTRING(40) it works.

Rado


[Non-text portions of this message have been removed]