Hello All,
I am new to mysql stored procedures. I am working on a project that entails converting an mssql database to mysql. I have succeeded in migrating the database. I have also converted some stored procedures. I however have this particular one that requires the passing of a semi-colon delimited parameter. In MSSQL, the procedure is below;
Code:
CREATE PROCEDURE [dbo].[selectUserTabsByRoles] 
	@var varchar(max)
AS
BEGIN
	
	 DECLARE @split TABLE (word VARCHAR(64))
	 DECLARE @word  VARCHAR(64),@start INT, @end INT, @stop  INT
	 SELECT @var += ';',@start = 1,@stop = Len(@var) + 1
	 WHILE @start < @stop
	  BEGIN
		  SELECT @end = Charindex(';', @var, @start),
				 @word = Rtrim(Ltrim(Substring(@var, @start, @end - @start))),
				 @start = @end + 1
		   INSERT @split VALUES (@word)
	  END
		SELECT distinct *
		FROM   tbl_tabs a
		WHERE  EXISTS (SELECT *
					   FROM   @split w
					   WHERE  Charindex(';' + w.word + ';', ';' + a.roles + ';') > 0) AND parent is null and tabstatus =1
	ORDER BY tabposition
END
I need help in converting this procedure to work in MySQL.
Any help on this will be appreciated.