问题
My query below being called from sqlplus is returning lot of spaces in the end of each value, how can I remove it?
See example below: * I substituted the values with x
x ,x
,x ,x ,x,x
x
My query is:
set linesize 1000
set trimspool on
set trimout on
set pagesize 0
set colsep ,
set feedback off
spool /result.csv
SELECT process_id,
x1,
x2,
x3,
x4,
x5,
x6,
x
FROM x
WHERE x IN ('x');
回答1:
The simplest way is to concatenate the columns with the commas in between, rather than using colsep
:
select process_id
||','|| x1
||','|| x2
...
Note that you only have the comma in the concatenation strong, not between the columns. You end up with a single column in the reult.
来源:https://stackoverflow.com/questions/17390755/how-to-remove-blank-spaces-from-sqlplus-query