'how to split a string in stored procedure of DB2

I need split a string in DB2, my string is for example:

2660____,275____,10472316, ...

I need a loop to get all of the them, I know exists FOR in stored procedure DB2, But I can't use that

I write that for example:

FOR i AS mycursor CURSOR FOR SELECT SUBSTR(list, 1, LOCATE(',',list)-1) FROM SYSIBM.SYSDUMMY1 do
    ...
END FOR;

But that doesn't work.

thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source