Subject Re: LIKE operator inside stored procedure
Author Alexander V.Nevsky
--- In firebird-support@yahoogroups.com, "zdeseb" <Zdenek.Sebl@m...>
wrote:
> Hello,
> I have stored procedure with VARCHAR parameter. And I have table
> PATHS with indexed column PATH_VALUE (VARCHAR).
>
> Inside procedure is following statement
>
> UPDATE PATHS
> SET PATH_DELETION = NULL
> WHERE PATH_VALUE LIKE :PARAMETER;
>
> Now I call this procedure
>
> EXECUTE PROCEDURE NAME('\\path\hsjha\%');
>
> index is not used and table PATHS is sequentialy readed.

Because when procedure is compiled, server don't know will parameter
be 'string%' or '%string%' and generates BLR which can always be
performed. The same about prepare any parametrized query with Like.

Best regards,
Alexander.