function xxdm_prvd_valid_email_f(p_ email varchar2)
return varchar2
is
lv_emails varchar2(3000);
begin
select substr (sys_connect_by_path (email , ','), 2) emails into lv_emails
from (select email,row_number () over (order by email ) rn,
count (*) over () cnt
from
(
select regexp_substr(p_email,'[^,]+', 1, level) email from dual
connect by regexp_substr(p_email,'[^,]+', 1, level) is not null
)
where regexp_like (email,'^[A-Za-z0-9._%+-]+@[A- Za-z0-9.-]+\.[A-Za-z]{2,4}$')
)
where rn = cnt
start with rn = 1
connect by rn = prior rn + 1;
return lv_emails;
exception
when others then
return null;
end xxdm_prvd_valid_email_f;