Subject Re: [firebird-support] Re: URGENT - CONCATENATION ERROR - BUG
Author Svein Erling Tysvaer
Modifying your function a little bit (mainly to fit my system, I haven't
got any UDFs installed on this PC):

CREATE PROCEDURE P_TESTCONCAT (
NUM Integer)
returns (
TXT VarChar(2000))
AS
DECLARE VARIABLE CTX VARCHAR(13) DEFAULT ' BEZEICHNER: ';
BEGIN
TXT = '';
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
/* THE NEXT COMMAND CAUSES THE ERROR, THE LENGTH OF THE RESULT
EXCEEDS 255 CHARACTERS */
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
TXT = TXT || CTX || CAST(NUM AS VARCHAR(8));
SUSPEND;
END

everything works OK when I issue SELECT TXT FROM P_TESTCONCAT(12345678)
(using Fb 1.5.4 SS). Hence, my guess is that your problem is related to
the UDF STRLEN (which, strictly speaking, isn't a Firebird problem). I
practically never use UDFs myself, but guess it has something to do with
how you defined the udf - at least that seems like the cause in a
similar problem here:

http://forums.devshed.com/firebird-sql-development-61/udf-substr-dosen-t-work-properly-141568.html

HTH,
Set

crizoo4712 wrote:
> the following sp causes the same error.
> "..is not a valid floating point value" in debug mode.
>
> CREATE PROCEDURE P_TESTCONCAT
> AS
> DECLARE VARIABLE TXT VARCHAR(2000) DEFAULT '';
> DECLARE VARIABLE CTX VARCHAR(13) DEFAULT ' BEZEICHNER: ';
> DECLARE VARIABLE NUM INTEGER DEFAULT 12345678; /* THIS IS A VALID
> NUMBER, INTEGERS CAN STORE UP TO 2,147,483,647 */
> DECLARE VARIABLE LEN INTEGER;
>
> BEGIN
> TXT = TXT || CTX || CAST(NUM AS VARCHAR(8)); LEN = STRLEN(TXT);
> TXT = TXT || CTX || CAST(NUM AS VARCHAR(8)); LEN = STRLEN(TXT);
> TXT = TXT || CTX || CAST(NUM AS VARCHAR(8)); LEN = STRLEN(TXT);
> TXT = TXT || CTX || CAST(NUM AS VARCHAR(8)); LEN = STRLEN(TXT);
> TXT = TXT || CTX || CAST(NUM AS VARCHAR(8)); LEN = STRLEN(TXT);
> TXT = TXT || CTX || CAST(NUM AS VARCHAR(8)); LEN = STRLEN(TXT);
> TXT = TXT || CTX || CAST(NUM AS VARCHAR(8)); LEN = STRLEN(TXT);
> TXT = TXT || CTX || CAST(NUM AS VARCHAR(8)); LEN = STRLEN(TXT);
> TXT = TXT || CTX || CAST(NUM AS VARCHAR(8)); LEN = STRLEN(TXT);
> TXT = TXT || CTX || CAST(NUM AS VARCHAR(8)); LEN = STRLEN(TXT);
> TXT = TXT || CTX || CAST(NUM AS VARCHAR(8)); LEN = STRLEN(TXT);
> TXT = TXT || CTX || CAST(NUM AS VARCHAR(8)); LEN = STRLEN(TXT);
> /* THE NEXT COMMAND CAUSES THE ERROR, THE LENGTH OF THE RESULT
> EXCEEDS 255 CHARACTERS */
> TXT = TXT || CTX || CAST(NUM AS VARCHAR(8)); LEN = STRLEN(TXT);
> END
>
> regards, christoph