是否有內置函數Oracle DB 11g r2可以將varchar2變量解析爲表? listagg或wm_concat的對面。我發現只有湯姆凱特的方法,於2006年:將表varchar2解析爲表(Oracle)
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必須有更簡單的方法。
[查詢使用甲骨文LISTAGG()的可能重複(http://stackoverflow.com/questions/13258746/oracle-listagg-for-querying-use) – Ben