Subject Re: [ib-support] Substring gives odd result
Author Claudio Valderrama C.
<rvellacott@...> wrote in message
news:9u395l+8rtm@......
> Why does this procedure return '23456' when it should return '12345'?

Roger:

SQL> SET TERM ;^
SQL> set term ^;
SQL> CREATE PROCEDURE TESTPROC
CON> RETURNS
CON> (RESULT VARCHAR(12))
CON> AS
CON> BEGIN
CON> RESULT = SUBSTRING('123456789' FROM 1 FOR 5);
CON> END^
SQL> set term ;^
SQL> execute procedure testproc;

RESULT
============
12345

You are using an old version, 0.94, 0.95? The logic used to take more than
one path so I had to adjust the "start" index before it diverted... damned
DSQL layer.

http://sourceforge.net/tracker/index.php?func=detail&aid=450301&group_id=902
8&atid=109028
It was fixed in mid August. Unfortunately, it's in the wrong category: the
bug only affects the DSQL layer that passed a shifted parameter sometimes;
the function works correctly in the core engine. Don't know if it's worth
the time to change its category since it's closed.

Please get a new version and don't forget to try our new bugs.
:-) :-) :-)

C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing