This content has been marked as final. Show 3 replies
use set colsep ';' before spool command
Uisng the colsep',' before the spool it doesnt work, i have tried that many times.
I also have a problem of the columns not been displayed properly on the .csv file, i get values like that, with spaces
122982130122 ,604470871,436641000015 ,A1NV12_1 ,XC ,232011030000015,1
one of others solutions was not to use the colsep',', just by calling the columns1||'.'||, that somehow prints the sqlplus commands (the columns headers),
so i'm out of ideas.
Try this one.
Trim will remove all the blank spaces.
SET PAGESIZE 0 LINESIZE 2000 TRIMSPOOL ON FEEDBACK OFF ECHO OFF TERMOUT OFF; SPOOL "C:\SPOOL_RESULT.CSV" SELECT 'A'||';'|| 'B'||';'|| 'C'||';'|| 'D'||';'|| 'E' FROM DUAL UNION ALL SELECT A||';'|| B||';'|| C||';'|| D||';'|| trim(E) FROM SOME_TABLE; SPOOL OFF; CLEAR BUFFER;
SQL> select length('0 ') from dual; LENGTH('0') ----------- 7 SQL> select length(trim('0 ')) from dual; LENGTH(TRIM('0')) ----------------- 1