How To Export Data Into CSV File 

I am having a table with 5 colulmns and 1 million record how to export the data into a csv or sql file with some delimiter?


c1 number,
c2 varchar2(40),
c3 varchar2(80),
c4 number,
c5 varchar2(8));

      FOR i IN 1..1000 loop         
             INSERT INTO mytable          
             VALUES (i, 'Test '||i, 'Data for test row '||i, mod(i,43)+1, 'Final');     
      end loop;     

SELECT c1||',"'||c2||'","'||c3||'",'||c4||',"'||c5||'"'
FROM mytable
spool DATA.csv

spool off

Have a Oracle Question
Do you have an Oracle Question?

Oracle Books
Oracle Certification, Database Administration, SQL, Application, Programming Reference Books

Oracle Home
Oracle Database, SQL, Application, Programming Tips

All the site contents are Copyright © and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of or the content authors.