如何解决如何删除或跳过字符串中的多个新行?
DECLARE
v_string VARCHAR2(4000) := 'A database is an organized collection of data,generally stored and accessed electronically
from a computer system. Where databases are more
complex they are often developed
using formal design and modeling techniques.';
v_sql_code_new VARCHAR2(4000);
BEGIN
END;
/
Desired output:
A database is an organized collection of data,generally stored and accessed electronically
from a computer system. Where databases are more
complex they are often developed
using formal design and modeling techniques.
我正在尝试从字符串中删除所有换行符。我尝试使用regexp_replace,但无法获得所需的结果。 谢谢进阶
解决方法
尽管您也可以将'^\s*$'
与modifier=>'mn'
一起使用,但最简单的方法是替换多个chr(10):
DECLARE
v_string VARCHAR2(4000) := 'A database is an organized collection of data,generally stored and accessed electronically
from a computer system. Where databases are more
complex they are often developed
using formal design and modeling techniques.';
v_sql_code_new VARCHAR2(4000);
BEGIN
dbms_output.put_line(regexp_replace(v_string,chr(10)||'(\s*'||chr(10)||')+',chr(10)));
END;
/
\s*
只是为了删除仅包含空格字符的行。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。