Problem with create procedure Here is what I tried.
CREATE PROCEDURE 'sr19'.sp_find_food(
IN search_string varchar(255)
) LANGUAGE SQL
BEGIN
DECLARE ss VARCHAR(257);
SET ss = CONCAT('%',search_string,'%');
SELECT NDB_No,Long_Desc FROM 'sr19'.food_desc WHERE Long_Desc LIKE
ss;
END
It should be onvious what I am trying to do. I want a map of id
numbers (NDB_No) to food names (Long_Desc) for which all of the food
names contain the string passed to the procedure in search_string. I
do not care where the search string appears in the food name, only
that it is there. I am doing the search in a table in the database
called sr19, and I am trying to attach the procedure to the same
database.
The error message is relatively useless in that all it says is that
there is an error in the SQL syntax used for the select statement.
Does anyone see my error? I am puzzled since the following works as
desired:
SELECT NDB_No,Long_Desc FROM 'sr19'.food_desc WHERE Long_Desc LIKE
'%Butter%';
Thisw statement returns 151 records.
Any ideas?
Ted |