I have a requirement to make data in oracle as below:
Condition :- Values till last comma (Maximum 20 Chars).
Data | Length | Output
----------------------------------------------------
12,34,abc,D,eva,096,qwerty | 26 | 12,34,abc,D,eva,096
----------
12,34,abc,DEF,0014,nish | 23 | 12,34,abc,DEF,0014
----------
12,34,abc,DEF,0014,gup, | 23 | 12,34,abc,DEF,0014
----------
12,34,abc,D,eva | 15 | 12,34,abc,D,eva
----------
I Have tried below query to get data, its giving result with comma in last and i don't know how to restrict string limit in regexp.
SELECT regexp_substr('12,34,abc,DEF,0014,nish', '(.)+,') FROM dual;