Example:
select empno|| ‘,’||ename||’&’||mgr from X;
Other option is using:
SQL> set colsep ‘,’
SQL> spool c:\testexcel.csv
SQL> select * from emp;
Change some of the default SQL*Plus parameters, that will be garbage for Excel:
feedback=off
newpage=none
termout=off
header=off
If some columns are empty, be aware to include the delimiter, too:
nvl(to_char(col2),’,’)
This is a really useful technique in analyzing data. I have used this technique many times in extracting data for analysis in Excel.
I have a suggestion, if you use the pipe(|) symbol as a delimiter, you will remove the possibility of a comma in the data(e.g. in address fields) causing problems with your extract.
LikeLike