man*_*nju 5 sql oracle newline
目前在测试表的地址栏中,我有以下格式的数据,
第12街
测试大道
Test_City
但在输出中,我会以下列格式要求它,
第12街测试大道Test_City.
请问任何人请告诉我用于以所需方式显示它的查询.
你可以试试这个:
select regexp_replace(your_address,'[[:space:]]',' ') from your_tab;
Run Code Online (Sandbox Code Playgroud)
只需从字符串中去除 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;
Run Code Online (Sandbox Code Playgroud)
结果:
This is the value
that I chose
This is the value that I chose
Run Code Online (Sandbox Code Playgroud)
两个空格,因为我在文本中输入了两个回车。
尝试这个:
translate(' example ', chr(10) || chr(13) || chr(09), ' ')
Run Code Online (Sandbox Code Playgroud)
上面的代码将用空格 (' ') 替换所有换行符 (chr(10))、所有制表符 (chr(09)) 和所有回车符 (chr(13))。
如果您希望删除这些字符,只需将“example”替换为您的字段名称即可。