I’m looking to write a stored procedure that takes as a parameter a string that’s delimited by a token and then to run a while loop in the procedure for every item in that string.
I’m not seeing anything in the mysql documentation that would accomplish this task… is there a way to do this?
Unfortunately, mysql doesn’t let functions return arrays or tables (that I know of) so you have to do this a bit hackily.
Here’s a sample stored proc:
This will tokenize your string, and insert the values into a table called “tokens”, one token per row. You should be able to modify it to do something useful pretty easily. Also, you may want to increase the input length from 200.