帮忙看看以下的PLSQL语句哪里有错,怎么修改,万分感谢!! select ''' || replace('ds,dd',',','''from dual union all select''') ||'''from dual;我是想将‘ds,dd’分两行也就是‘ds’ 'dd'查出来,请各位帮帮忙,谢谢!! ------解决方案--------------------
select REGEXP_SUBSTR(c1, '[^,]+', 1, LEVEL) STR
from (select 'ds,dd' c1 from dual) t
CONNECT BY LEVEL <= REGEXP_COUNT(c1, ',') + 1
and rowid = prior rowid
and prior dbms_random.value is not null;
------解决方案--------------------
with a as (
SELECT 'ds,dd,33,2,34,,2,2' col FROM dual )
SELECT REGEXP_SUBSTR(col, '[^,]+', 1, LEVEL)
FROM A
CONNECT BY LENGTH(REGEXP_SUBSTR(col, '[^,]+', 1, LEVEL)) > 0