Google some old postings here about spliting comma separated lists. I
have a signle query version out there that uses a sequence table and no
proceudral code.
However, any typo will screw up things and you still need to go back
and fix the real problem -- lack of proper column constraints! Mop the
floor and fix the leak! Do not let this crap in your database again.