Subject Re: [firebird-support] cannot use variable on SUBSTRING
Author Ivan Prenosil
> There's something bothering me on using SUBSTRING.
> I've tried this :
>
> CREATE PROCEDURE SPTEST
> AS
> declare variable vFrom integer;
> declare variable vTo integer;
> declare variable vText varchar(25);
> begin
> vText = 'SUBSTRING TEST';
> vFrom = 3;
> vTo = 10;
> vText = SUBSTRING(vText from :vFrom for :vTo);
> end
>
> "Token Unknown :' is always appear when I create this procedure. Is it right
> that internal function SUBSTRING cannot use variable ? To solve this problem
> I usually using SUBSTR from ib_udf for temporary.

Right. FROM&FOR can't use variables. This limitation is removed from Firebird 2.

Sometimes as a workaround EXECUTE STATEMENT can be used.

Ivan