SELECT ID,班组,班次日期, REGEXP_SUBSTR(TIME_RANGE, '[^;]+', 1, LEVEL) TIME_RANGE --level为对应第level个所拆分字符串,正则表达式匹配分隔符拆分
FROM 排班表
WHERE 1 = 1
CONNECT BY LEVEL <= REGEXP_COUNT(TIME_RANGE, ';') + 1 --找到拆分字符串个数,即分隔符个数加1
AND PRIOR ROWID = ROWID --递归自身
AND PRIOR DBMS_RANDOM.VALUE IS NOT NULL --避免死循环
AND REGEXP_SUBSTR(TIME_RANGE, '[^;]+', 1, LEVEL) IS NOT NULL