已知有一表 mail栏位有 smid,userid,sysid,mailadd
其中smid为主键
例如表中有以下数据
smid userid sysid mailadd
1 123 343 [email protected],[email protected]
2 345 674 [email protected],[email protected]
3 453 787 [email protected], [email protected]
4 2333 6756 [email protected],[email protected]
5 4545 6767 [email protected]
6 4521 8965 [email protected]其中 mailadd 中的资料不固定,可以添加
现要求得到 mailadd中所有 邮箱地址(不能重复)
请问该如何实现
其中smid为主键
例如表中有以下数据
smid userid sysid mailadd
1 123 343 [email protected],[email protected]
2 345 674 [email protected],[email protected]
3 453 787 [email protected], [email protected]
4 2333 6756 [email protected],[email protected]
5 4545 6767 [email protected]
6 4521 8965 [email protected]其中 mailadd 中的资料不固定,可以添加
现要求得到 mailadd中所有 邮箱地址(不能重复)
请问该如何实现
SELECT DISTINCT regexp_substr(mailadd, '[^,]+', 1, LEVEL)
FROM mail
CONNECT BY LEVEL <= length(mailadd) - length(REPLACE(mailadd, ',')) + 1;
报错,ora-00904: "REGEXP_SUBSTR":invalid identifier
instr(t.ca, ',', 1, c.rn) + 1,
instr(t.ca, ',', 1, c.rn + 1) -
(instr(t.ca, ',', 1, c.rn) + 1)) AS MAILADD
FROM (SELECT ',' || MAILADD || ',' AS ca,
length(MAILADD || ',') -
nvl(length(REPLACE(MAILADD, ',')), 0) AS cnt
FROM DGEIP.EIP_SYS_MAIL
) t,
(SELECT rownum rn FROM all_objects WHERE rownum <= 10) c
WHERE c.rn <= t.cnt