问题描述
如何按特定长度(而不是定界符)将字符串拆分为列 例如,该字符串是一个40000个字符的查询,我需要将其拆分为3000个字符串,然后在其中运行替换操作,因为该字符串中包含“ $,并且需要用某些可替换字符替换
select $,$ from (select $,$ from where ...... id=$ .......
...
..
....
order by $)
现在我需要将$替换为我的特定值。。我尝试过,但是由于缓冲区原因,它没有返回完整的40000长度的查询。
解决方法
简单方法:
select regexp_substr('qwertyuioplkjhgfdsazxcvbnm','.{1,6}',1,level) as mini_str_len_6
from dual
CONNECT by LEVEL <= regexp_count('qwertyuioplkjhgfdsazxcvbnm','(.{1,6})');
结果:
qwerty
uioplk
jhgfds
azxcvb
nm