Subject Re: [ib-support] Substring gives odd result
Author Robert F. Tulloch
rvellacott@... wrote:
>
> Why does this procedure return '23456' when it should return '12345'?
>
> CREATE PROCEDURE TESTPROC
> RETURNS
> (RESULT VARCHAR(12))
> AS
> BEGIN
> RESULT = SUBSTRING('123456789' FROM 1 FOR 5);
> END
>
> EXECUTE PROCEDURE TESTPROC

Perhaps is should be 0 for 5. SUBSTR('123456789',1,5) would return
12345