I hope someone can help. I created my first stored procdure (nothing out of the ordinary), but I ran into a problem.
I want to give it a string input like 1,2,3,4,5 then it makes it simple SELECT * FROM [TABLE] WHERE EAN IN (VAR);
So, the stored procedure is as follows:
DELIMITER $$
CREATE PROCEDURE `moments`.`new_procedure`(IN var1 VARCHAR(255))
BEGIN
SELECT * FROM moments.PRODUCT WHERE EAN IN (var1);
END
I try to execute it like this:
Work
call moments.new_procedure('5045318357397')
Does not work
call moments.new_procedure('5045318357397,5045318357427');
Running but not returning any results. Does it split the second statement as a string, so does this:
select * from moments.PRODUCT WHERE EAN IN ('5045318357397,5045318357427')
not this:
select * from moments.PRODUCT WHERE EAN IN ('5045318357397','5045318357427')
How do I format the input in an execute request to force it to take a comma delimited string as input?
source
share