SQL Plus - Csv Export

> Procedural Languages > (SQL Plus|SqlCl) (Oracle Database Console)

1 - About

How to export a CSV with SQL Plus.

3 - Snippet

Export of the tables all_objects

SET echo off
SET linesize 32767
SET LONG 90000 -- For the size of lob and long data type
SET LONGCHUNKSIZE 90000; -- ColumnSize of a lob or long
SET wrap off; -- A column must not go on more than one line
SET heading off  
SET colsep ';' 
SET pagesize 0;
SET feed off;
SET termout off;
SET trimspool ON; -- No space
SELECT * FROM all_objects WHERE ROWNUM < 10;
spool all_objects.csv
spool off