Loop comma separated values and insert after with trigger in mySQL
<p>Please help, I need to create Loop in trigger with comma sepator value in mysql.</p>

<p><strong>Sample Table tbl_migrasi</strong></p>

<pre>
id_tps |   suara   |
------ | ----------|
   1   | 2,15.3,35 |
   2   | 2,14.3,34 |
</pre>

<p><strong>Sample my trigger</strong></p>

<pre><code>DROP TRIGGER IF EXISTS `trigger_migrasi`;
    DELIMITER //
    CREATE TRIGGER `trigger_migrasi` AFTER INSERT ON `tbl_migrasi`
     FOR EACH ROW BEGIN
     BEGIN
     SET @mydata= (select suara from tbl_migrasi WHERE suara=NEW.suara order by migrasi_id desc limit 1);
     IF @dataku IS NOT NULL THEN
       SET @total= (select LENGTH(suara) - LENGTH(REPLACE(suara, ',', '')) AS total from tbl_migrasi WHERE suara=NEW.suara ORDER BY migrasi_id DESC LIMIT 1);
       SET @x = 1;
       WHILE @x &lt; @total DO
       INSERT INTO tbl_rekapitulasi
       SET @x = @x + 1;
       SET @y = @x + 1;
         (tps_kode, kandidat_id,rekapitulasi_suara)
         VALUES
         (NEW.migrasi_tps,SPLIT_STR(SPLIT_STR(@mydata, ',', @x), '.', @x),SPLIT_STR(SPLIT_STR(@mydata, ',', @y), '.', @x));
       END WHILE;
     END IF;
     END
    END
</code></pre>

<p><strong>I Nedd to Output Table tbl_kandidat</strong></p>

<pre>
id_tps | kandidat_id | suara |
------ | ----------- | ----- |
   1   |      2      |  15   |
   1   |      2      |  14   |
   2   |      3      |  35   |
   2   |      3      |  34   |
</pre>