I am running a simple recursive loop. For some reason the insert is causing a deadlock issue. How can I avoid this. I tried the Delay hint, but nothing is working. Any suggestions would be greatly appreciated!!
CREATE procedure recursive() BEGIN START TRANSACTION; set @a := 1; insert into CteTree(personid,tallerpersonid,TallPath,depth) select m.shorterpersonid ,m.tallerpersonid ,'test' ,0 FROM map AS m ; WHILE row_count() > 0 do set @a := @a+1; insert into CteTree(personid,tallerpersonid,TallPath,depth) SELECT m.ShorterPersonID ,m.tallerpersonid ,'test' ,@a FROM CteTree AS t INNER JOIN map AS m ON m.TallerPersonID = t.PersonID where t.depth = @a - 1; end while; commit; end;