Here is my issue. I have the following stored procedure in which i pass the variable 'session_ids' which is actually a set of values ('1','2','3',..., 'n'). How can i pass-split each of these values into corresponding number of rows to a temporary table? For example, row 1 has the value '1', row 2 has the value '2',..., row n has the value 'n'.
Actually, i want to do this dynamically because i don't know the number of values in the variable 'session_ids'. I have this in my mind but it doesn't work.
PROCEDURE `migrate_session_ids`(IN session_ids LONGTEXT)
CREATE TEMPORARY TABLE tempTable (id INT NOT NULL AUTO_INCREMENT, session_id BIGINT, PRIMARY KEY (`id`));
INSERT INTO tempTable(session_id) SELECT * FROM session_ids;
Thank you in advance