Subject Re: [firebird-support] substr(s,m,n) caused arithmetic exception, numeric overflow, or string truncation
Author Helen Borrie
At 02:07 PM 19/12/2003 -0800, you wrote:
>Background: FB 1.5 RC6, Windows 2000.
>
>I have table news where txt is a column defined as
>varchar(255).
>
>When issuing the SQL:
>select substr(txt,1,2) from news;
>
>
>Then, I get the mentioned error. I am certain that
>all txt rows contains enough text (20 characters or
>more).

Is the example the way you are actually calling the UDF? The exception
you report shouldn't (couldn't) occur with this statement.

fwiw, I've just run your statement on several samples, including a unicode
column that has null on several rows, without exception.

Firebird has an internal function SUBSTRING() which avoids the UDF, btw.

select substring(txt FROM 1 FOR 2) as outputcol from news;

/heLen