Oracle select CLOB 列在使用 chr(10) 和 chr(13) 后仍然有换行符
Oracle select CLOB column still has line break even after using chr(10) and chr(13)
我有以下疑问:
查询 1:
select column1, column2 from table1 where column1 = 12345;
结果 1:
column1|column2
12345|Topics briefed:
|1) How to catch a fish
|without using a fishing rod
|2) How to cook a fish
查询 2:
select column1, REPLACE(REPLACE(column2, chr(10), ''), chr(13), '') as col2 from table1 where column1 = 12345;
结果 2:
column1|col2
12345|Topics briefed: 1) How to catch a fish
|without using a fishing rod 2) How to cook a fish
结果 2 不是我想要的,我希望所有内容都排成一行。我怎样才能达到以下结果:
column1|col2
12345|Topics briefed: 1) How to catch a fish without using a fishing rod 2) How to cook a fish
提前致谢!
也许这行得通:
select column1, REPLACE(REPLACE(REPLACE(column2, chr(10), ''), chr(13), ''), chr(09), '') as col2
from table1
where column1 = 12345;
你没有说你是如何显示这些结果的,但我的猜测是你实际上已经去掉了换行符,但是无论你用来显示它们的是什么,都会将它们换行。如果你在 sqlplus 中,你可以 set linesize 999
使行非常宽,column column2 format a200
使第 2 列显示 200 个字符宽。
我有以下疑问:
查询 1:
select column1, column2 from table1 where column1 = 12345;
结果 1:
column1|column2
12345|Topics briefed:
|1) How to catch a fish
|without using a fishing rod
|2) How to cook a fish
查询 2:
select column1, REPLACE(REPLACE(column2, chr(10), ''), chr(13), '') as col2 from table1 where column1 = 12345;
结果 2:
column1|col2
12345|Topics briefed: 1) How to catch a fish
|without using a fishing rod 2) How to cook a fish
结果 2 不是我想要的,我希望所有内容都排成一行。我怎样才能达到以下结果:
column1|col2
12345|Topics briefed: 1) How to catch a fish without using a fishing rod 2) How to cook a fish
提前致谢!
也许这行得通:
select column1, REPLACE(REPLACE(REPLACE(column2, chr(10), ''), chr(13), ''), chr(09), '') as col2
from table1
where column1 = 12345;
你没有说你是如何显示这些结果的,但我的猜测是你实际上已经去掉了换行符,但是无论你用来显示它们的是什么,都会将它们换行。如果你在 sqlplus 中,你可以 set linesize 999
使行非常宽,column column2 format a200
使第 2 列显示 200 个字符宽。