从大逗号分隔的文本中获取单列多行的解决方案。
Like
2015,PLANT,PEST,AND,DISEASE,CONTROL,PLANT,PEST
Should come as
col1
-----
2015
PLANT
PEST
AND
DISEASE
CONTROL
PLANT
PEST
随处可用的reg-ex解决方案不适用于> 4000个字符的数据
您未指定what不适用于您使用的正则表达式(以及您使用的是哪个正则表达式),但是-对我来说,它可以正常工作(尽管没有那么长的示例,但是-我建议您尝试一下。
SQL> with test (col) as
2 (select '2015,PLANT,PEST,AND,DISEASE,CONTROL,PLANT,PEST' from dual union all
3 select '2020,LITTLE,FOOT,WHAT,DOES,NOT,WORK' from dual
4 )
5 select regexp_substr(col, '[^,]+', 1, column_value) col1
6 from test cross join
7 table(cast(multiset(select level from dual
8 connect by level <= regexp_count(col, ',') + 1
9 ) as sys.odcinumberlist));
COL1
--------------------------------------------------------------------------------
2015
PLANT
PEST
AND
DISEASE
CONTROL
PLANT
PEST
2020
LITTLE
FOOT
WHAT
DOES
NOT
WORK
15 rows selected.
SQL>