Subject | Re: [firebird-support] arithmetic overflow errors |
---|---|
Author | Helen Borrie |
Post date | 2004-08-19T23:32:01Z |
At 04:23 PM 19/08/2004 +0000, you wrote:
memory after the functions return.
The full text of the exception you see is "Arithmetic exception, numeric
overflow, or string truncation". For what you are doing, the problem is
string truncation.
Are you storing your CHARS and VARCHARS using a multi-byte character set,
such as UNICODE_FSS? If so, your varchar (1024) will not fit into a
cstring(1024) parameter, giving rise to the disallowed string
truncation. For UNICODE_FSS, you would need to declare your functions with
parameters three times as large as the length in characters.
Another cast on your problem might have come to light if you had reported
that you were seeing an additional message "Cannot transliterate character
between character sets". Did you see that?
/heLen
>Hello,See Ivan's comment about FREE_IT. You need this to deallocate string
>
>I keep getting arithmetic overflow errors trying to take the leftmost
>80 char from a 1024 char variable and assign to a 80 char variable.
>I'm using freeudflib redeclared with 1024 char parameters. What is
>the right way to accomplish this? Thanks.
>
>declare external function f_BiglrTrim
>cstring(1024)
>returns
>cstring(1024) /* free_it */
>entry_point 'lrTrim' module_name 'FreeUDFLib.dll';
>
>declare external function f_BigLeft
>cstring(1024), integer
>returns
>cstring(1024) /* free_it */
>entry_point 'Left' module_name 'FreeUDFLib.dll';
>
>CREATE PROCEDURE TEST
>AS
>DECLARE VARIABLE bigcomment VARCHAR(1024);
>DECLARE VARIABLE smallcomment VARCHAR(80);
>BEGIN
>
>/* Cause arithmetic overflow errors */
>smallcomment = f_bigleft(f_biglrtrim(bigComment),80);
memory after the functions return.
The full text of the exception you see is "Arithmetic exception, numeric
overflow, or string truncation". For what you are doing, the problem is
string truncation.
Are you storing your CHARS and VARCHARS using a multi-byte character set,
such as UNICODE_FSS? If so, your varchar (1024) will not fit into a
cstring(1024) parameter, giving rise to the disallowed string
truncation. For UNICODE_FSS, you would need to declare your functions with
parameters three times as large as the length in characters.
Another cast on your problem might have come to light if you had reported
that you were seeing an additional message "Cannot transliterate character
between character sets". Did you see that?
/heLen