Getting rid of additional spaces while spooling the data to text file.
Hi,
I am facing an issue where in I am trying to spool result returned by a select query to a file.
What I want is the folloing result:
$> cat testfile.txt
name1|age1|id1|
name2|age2|id2|
.....
nameN|ageN|idN|
But what I am getting:
name1 |age1 |id1 |
name2 |age2 |id2 |
.....
nameN |ageN |idN |
Take a look at my script:( this is shell script.)
CONNECT $ORA_USER/$ORA_PWD@$ORACLE_SID
SET TERMOUT OFF
set colsep '|'
set linesize 3000
set pagesize 0
set heading off
SET TRIMSPOOL ON
spool $file_path;
$sql_query;
Please suggest me some ways I can achieve the desired output. However I have the option to go for sed command in shell script to remove all white spaces. But I am looking if something can be done in sqlplus side. And also note that Select col1||'|'||col2||'|'||col3 from ....