I pass value to store procedure. The logic is to split value by comma and using a loop.
@Colomns Id,Firstname,Lastname
@values 1,'foo','bar'
Query should be
Select * from user where Id = 1 and Firstname = 'foo' and Lastname = 'bar'
I pass value to store procedure. The logic is to split value by comma and using a loop.
@Colomns Id,Firstname,Lastname
@values 1,'foo','bar'
Query should be
Select * from user where Id = 1 and Firstname = 'foo' and Lastname = 'bar'
Just use substring_index()
or concat()
:
Select *
from user
where concat_ws(Id, firstname, lastname) = @param;
Then, fix the stored procedure to take three parameters! There is no advantage to putting three values into a string, rather than passing in three separate values.