Subject Re: Character set was RE: Digest Number 1619
Author p_lerner
Thanks, I feel a bit better now: only have 438 hours, still some to
go.

But I still can't make t work.

Executing:
"UPDATE Table
set newFld = cast (_NONE oldFld as VARCHAR(70) CHARACTER SET
_ISO8859_1)"

returns "Token Unknown" on "oldFld"

And executing :
"set newFld = _ISO8859_1 oldFld"

returns "Token Unknown" on "oldFld" again.

Does anyone know how to write the syntax of this ??
Should I write a Store Procedure keeping each value to update in a
variable, and updating one at a time ??

greetings,

Pablo (Forest to my friends)

--- In firebird-support@yahoogroups.com, "peter_jacobi.rm"
<peter_jacobi@g...> wrote:
> Hi p_lerner,
>
> --- In firebird-support@yahoogroups.com, "p_lerner" wrote:
> > Well, I'm sorry to be remembering you to Forest Gump,
>
> Don't be worried, the first 1000 hours fighting against
> charset issues always look stupid.
>
> > Definitions:
> > oldFld: varchar(70) CHARSET: NONE COLLATION: NONE
> > newFld: varchar(70) CHARSET: ISO8859-1 COLLATION: ES_ES
>
> Answering without actually trying in ISQL (which is very
> dangerous, but I hope I'm lucky):
>
> > "UPDATE ordcompra
> > set newFld = ISO8859_1 oldFld
> > where oldFld is not null"
> [...]
> > The problem is that I get :
> > "Invalid token.
> [...]
>
> This is only syntactic hickup, use _ISO8859_1
> instead.
>
> > I also have try:
> > "update ordcompra
> > set prueba = cast(orc_motivo as VARCHAR(70) CHARACTER SET
ISO8859_1)
> > where orc_motivo is not null"
> >
> > but I get:
> > "Arithmetic overflow or division by zero has occurred.
> > arithmetic exception, numeric overflow, or string truncation.
> > Cannot transliterate character between character sets."
>
> This is correctly flagged illegal, as there is now way to
> transliterate a string of unknown character encoding.
>
> Your first try is better. You would have to combine both
> forms if you knew the characer encoding in the oldFld and
> it differs from the desired character encoding, this would
> be something like:
>
> set newFld = cast (_CP437 oldFld as VARCHAR(70) CHARACTER SET
ISO8859_1)
>
> Regards,
> Peter Jacobi