Subject Re: substr(s,m,n) caused arithmetic exception, numeric overflow, or string truncation
Author vmdd_tech
Helen, I now discover this problem is truly a bug or a limitation
of Firebird. To reproduce this problem, you need to insert a string
longer than 80 characters into a varchar(255), and then try to
do a substr on it.

Ben

--- In firebird-support@yahoogroups.com, "vmdd_tech"
<vmdd_tech@y...> wrote:
> Helen, I've just run the same test on my home computer (win xp),
and
> substr works fine. The problem may be specific to my work
> computer. I will
> investigate some more.
>
> Thanks,
>
> Binh
>
> --- In firebird-support@yahoogroups.com, Helen Borrie
<helebor@t...>
> wrote:
> > 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