简体   繁体   中英

Formatting the output of an SQL query

I am using the Solaris OS. From Solaris I'm logging into SQL*Plus . My database is Oracle 9i.

I am spooling the output of my query into a file. How can I get it in CSV format so that I can copy it into Excel?

My query is like the follwing.

select name,id,location from employee;

I have found a way out of it. We can use concatenation here,

select name,id,location from employee;

gives us 2 different columns, but not in CSV format.

I did

select name||','||id||','||location from employee;

We get the output in a CSV format. It has just concatenated the output with commas (,).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM