目前在测试表中的地址栏中,我的数据格式如下。
第十二街
测试大道
测试城市
但在输出中,我要求它的格式如下。
12街Test avenue Test_City。
有谁能告诉我用什么查询来以所需方式显示它。
你可以试试这个。
select regexp_replace(your_address,'[[:space:]]',' ') from your_tab;
把chr(13)和chr(10)从字符串中去掉:
declare
teststring varchar2 (32767) := ' This is the value
that I chose';
begin
dbms_output.put_line (teststring);
dbms_output.put_line (replace (replace (teststring, chr (13), ''), chr (10), ' '));
end;
结果是:
This is the value
that I chose
This is the value that I chose
两个空格,因为我在文本中输入了两个回车。
试试这个。
translate(' example ', chr(10) || chr(13) || chr(09), ' ')
上面的方法将用空格(' ')替换所有换行符(chr(10))、所有制表符(chr(09))和所有回车符(chr(13))。
只需将'example'替换为您的字段名,就可以删除这些字符。