如何按特定长度而不是定界符将字符串拆分为列

问题描述

如何按特定长度(而不是定界符)将字符串拆分为列 例如,该字符串是一个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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...