oracle的connect by level的示例

SELECT regexp_substr('CITY_AA,CITY_BB,CITY_CC,CITY_DD', '[^,]+', 1, LEVEL) t
FROM dual
CONNECT BY regexp_substr('CITY_AA,CITY_BB,CITY_CC,CITY_DD', '[^,]+', 1, LEVEL) IS NOT NULL
;

返回:

CITY_AA
CITY_BB
CITY_CC
CITY_DD

SELECT regexp_substr('CITY_AA,CITY_BB,CITY_CC,CITY_DD', '[^,]+', 1, 2) t
FROM dual
;

返回:

CITY_BB

 

posted on 2018-09-12 11:54  小甜瓜安东泥  阅读(455)  评论(0编辑  收藏  举报