I have a stored procedure where I am passing a CSV list of my values to be inserted into a table by the procedure.
My sp is
DELIMITER $$
USE `btwa`$$
DROP PROCEDURE IF EXISTS `sp_AddRole`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_AddRole`(IN _rolename VARCHAR(50) , IN _permissionList VARCHAR(255))
BEGIN
DECLARE _roleId INT;
INSERT INTO roles(RoleName, CreatedOn)
VALUES (_rolename,CURDATE());
SET _roleId = LAST_INSERT_ID();
/*INSERT INTO role_permissions(FkRoleId,FKPermissionId)
VALUES (_roleId, ...);*/here I want to insert values of _permissionList
END$$
DELIMITER ;
How can I get rows of int from permissionList which I might pass like '1,2,3,4'
I have done development in SQL Server but not much in MySQL.