adspace


How do I spool to a csv formatted file using sqlplus?

Answer Posted / Amar Gupta

"To spool a CSV formatted file in SQLPLUS, use the following command: `SPOOLOFF` (to turn off spooling) and then create a new file with `SPFILE <filename> SET TERMOUT OFF`; after executing your query, you can redirect output to the created file using `SPool <filename>.csv`. For formatting CSV, use `CHR(10)` for line breaks. Here's an example:
```sqln
SPOFF;n
SPFILE myfile SET TERMOUT OFF;n
SELECT column1 || ',' || CHR(10) || column2 || ',' || CHR(10) FROM your_table;n
SPOOL myfile.csv;"

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Design database draw er diagram for a certain scenario ?

4656


How to start an oracle instance?

1103


How to use values from other tables in update statements using oracle?

1158


What is oracle latest version?

1174


Please send me Informatica 8.1 certification dumps, my mail id mona85gupta@gmail.com

1956


How to put more than 1000 values into an oracle in clause?

1115


How to write a left outer join with the where clause in oracle?

1156


How to select all columns of all rows from a table in oracle?

1132