Oracle DB 11g r2中是否有可以将 varchar2 变量解析为表的内置函数?与listagg或wm_concat 相反。我只找到了2006 年Tom Kyte的方法:
with data as
(
select trim(substr (txt, instr(txt, ',', 1, level) + 1
, instr(txt, ',', 1, level + 1) - instr(txt, ',', 1, level) - 1)) as token
from (select ',' || :txt || ',' txt from dual)
connect by level <= length(:txt) - length(replace(:txt, ',', '')) + 1
)
select * from data;
我认为Oracle必须有更简单的方法。