oracle 字串分割轉化為多條記錄
阿新 • • 發佈:2019-02-04
select a.name (select COLUMNSTRJOIN(a.name)
from cmdb_keycity a
where a.id in
(SELECT REGEXP_SUBSTR(a.name,
'[^,]+',
1,
LEVEL,
'i') AS STR
FROM DUAL
CONNECT BY LEVEL <=
LENGTH(a.name) -
LENGTH(REGEXP_REPLACE(a.name,
',',
'')) + 1)) name
From table_name a and a.id = '001‘;
from cmdb_keycity a
where a.id in
(SELECT REGEXP_SUBSTR(a.name,
'[^,]+',
1,
LEVEL,
'i') AS STR
FROM DUAL
CONNECT BY LEVEL <=
LENGTH(a.name) -
LENGTH(REGEXP_REPLACE(a.name,
',',
'')) + 1)) name
From table_name a and a.id = '001‘;