select from comma separated string

FOR a IN (
select regexp_substr(p_to,'[^,]+’,1,level) recipient
from dual
connect by level <= length(regexp_replace(p_to,'[^,]+’)) + 1 )
LOOP
utl_smtp.rcpt( l_connection, a.recipient);
end loop;

Posted in IT