Subject Re: [firebird-support] Re: fail when checking VarChar variable <> ''
Author Helen Borrie
At 01:50 AM 8/12/2006, you wrote:
>Thanks Helen,
>Actually the missing ':'InternalMemo was a typo, it did exist in my
>I am traveling without your book right now, but I don't see how to
>add a collation to my variable declaration.

I don't believe it is possible to declare a COLLATE attribute for a
local variable but, at the very least, it's not valid to declare a
collation sequence for a variable without declaring the character set
that it is applicable to.

>I tried
>declare variable Internalmemo VarChar(2000) Collate 'ISO8859_1'

The attribute you want is not COLLATE but CHARACTER SET:

declare variable Internalmemo VarChar(2000) CHARACTER SET ISO8859_1

(without the quotes: it's an identifier)

My data is ISO-8859-1 so everything is single byte. I don't think I
>can overflow in this case,

Correct. Are you sure you are not also receiving isc errorcode
335544565 isc_transliteration_failed, "Cannot transliterate character
between character sets"? Absurd as it may seem, you get both
exceptions when there is a transliteration error. Your exception
handling for strings should test for both.

>however in this specific case the data is
>only about 500 char long, so there is absolutely no possibility.
>If I leave off the "if (InternalMemo <> '') test, all is well in the
>How to add the collation to the variable with FB 1.5.3?

Don't confuse character set and collation. And don't put quotes
around the character set identifier.