现在的位置: 首页 > 综合 > 正文

oracle添加换行符chr(13)

2017年12月27日 ⁄ 综合 ⁄ 共 664字 ⁄ 字号 评论关闭
 select ('abcdef'||chr(10)||chr(13)||'hjkml') from dual;

oracle中去掉文本中的换行符、回车符、制表符小结
一、特殊符号ascii定义
制表符 chr(9)
换行符 chr(10)
回车符 chr(13)

二、嵌套使用repalce,注意每次只能提交一个符号,如先回车再换行
          select REPLACE(gg, chr(10), '') from dual
    要注意chr(13) | | chr(10) 此类结合使用的情况比较多,回车换行在notepad中是比较好看点的,所以要考虑此种情况
          select translate(string,chr(13)||chr(10),',') from dual;

 

三、对于字符大对象的符号处理
    对于clob字段中的符号处理,先to_char然后一样的处理

SQL> select to_char(vcl),replace(to_char(vcl),chr(10),'[]') from test_1;



删除字段中换行符:

update t_d_Sysnotice t set t.s_name = replace(t.s_name,to_char(chr(13))||to_char(chr(10)),'')
where t.type = 2 and t.s_name like '%http%'




关键代码:select regexp_replace(t.s_name,chr(10)||chr(13),'') from t_d_Sysnotice t where id = 2552;

抱歉!评论已关闭.