I wrote stored procedure like this:
DELIMITER $$
CREATE PROCEDURE searchByTerm(term VARCHAR(300))
BEGIN
SET @statment = "Select name,description from products where name like '%?%' OR description like '%?%'";
PREPARE stmt FROM @statment;
SET @a = term;
SET @b = term;
EXECUTE stmt USING @a,@b;
DEALLOCATE PREPARE stmt;
END$$
calling it as :
CALL searchByTerm('xyz');
it results in following error:
Error Code : 1210
Incorrect arguments to EXECUTE
Am i doing anythng wrong? I know it can be done with concat statement but why it's not working like this? Can't i use same parameter multiple times? Thanks for any help..