Oracle REGEXP_SUBSTR line split into multiple lines

Example:

SELECT REGEXP_SUBSTR('1,2,3,4,5,6,7,8,9,10', '[^,]+', 1, LEVEL, 'i') AS STR   FROM DUAL  
CONNECT BY LEVEL <=LENGTH('1,2,3,4,5,6,7,8,9,10') - LENGTH(REGEXP_REPLACE('1,2,3,4,5,6,7,8,9,10',',','')) + 1

 

REGEXP_SUBSTR function following format:
function REGEXP_SUBSTR (srcstr, pattern, position, occurrence, modifier)
__srcstr: the string to a regular process
__pattern: regular expression matching, match the value returned will be returned by the policy decision __occurrence
__position: starting position, beginning from the first few characters of a regular expression matching (default. 1)
__occurrence: identification of several matched set, by default. 1
__modifier: mode ( 'i' case insensitive searching, 'c' to distinguish size write to search. The default is 'c'.)

Quote: https://www.cnblogs.com/softidea/p/5208128.html

Example:

SELECT REGEXP_SUBSTR('1,2,3,4,5,6,7,8,9,10', '[^,]+', 1, 3, 'i') AS STR   FROM DUAL 

SELECT REGEXP_SUBSTR('1,2,3,4,5,6,7,8,9,10', '[^,]+',5, 3, 'i') AS STR   FROM DUAL 

 

Guess you like

Origin blog.csdn.net/Peter_S/article/details/93471789