Subject Re: Error on UTF8 in concatenation?
Author Milan Babuskov
--- Martijn Tonies wrote:
> This SQL:
> SELECT R.RDB$RELATION_ID || '=', R.RDB$RELATION_NAME
> FROM RDB$RELATIONS R
> ORDER BY 1 ASC
>
> returns this error on an UTF8 database:
> arithmetic exception, numeric overflow, or string truncation
>
> If I remove the || '=' part, it works fine though.

It also works if you remove ORDER BY clause. And it also works if you
CAST first column to varchar:

SELECT cast(R.RDB$RELATION_ID || '=' as varchar(33)), R.RDB$RELATION_NAME
FROM RDB$RELATIONS R
order by 1

My guess is that Firebird tries to sort the first column as INTEGER
since RDB$RELATION_ID is integer. However, when you add '=' it cannot
be converted to integer anymore - and thus the error.

--
Milan Babuskov
http://www.guacosoft.com