Subject Re: [firebird-support] Re: An SQL stored procedure problem - any help
Author Pavel Menshchikov
Hello Steven,

>> WHERE
>> TYPICALTOPICS LIKE ''%'||:s_keyword||'%'' OR DESCRIPTION
>> LIKE ''%'||:s_keyword||'%''))';
>>
>> (You might need to paste this into a monotext editor to see the
s> difference)
>>
>> ./hb

s> Thanks for that Helen.
s> What I get now is:

s> Invalid token.
s> Dynamic SQL Error.
s> SQL error code = -104.
s> Token unknown - line 1, char 488.
s> %.
You may try CONTAINING instead of LIKE if you don't bother
case-sensitivity:
-----
WHERE
TYPICALTOPICS CONTAINING '''||:s_keyword||''' OR DESCRIPTION
CONTAINING '''||:s_keyword||'''))';
-----


s> and on debug mode:

s> Error Message:
s> ----------------------------------------
s> SQL Parse Error:

s> EOF in string detected
Maybe the parameter contains single quote, so you get a result string
like this (as EXECUTE STATEMENT see it):
-----
... LIKE '%abcd'ef%' ...
^^^^^^^ - that was the parameter value
-----
And it has to be
-----
... LIKE '%abcd''ef%' ...
-----
You have to double single quotes in the parameters before you can
concatenate them, in the way you do, for correct SQL statement.

s> Is my use of execute statement (VAR_SEARCHSTRING); a valid way to do
s> this?
Did you get my reply to your original message? (it's dated with Feb
23, 2005)


HTH
--
Best regards,
Pavel Menshchikov
http://www.ls-software.com