Exporting data to csv file with Oracle "spool" utility
--set serveroutput on;
SET ECHO OFF
SET NEWPAGE 0
SET SPACE 0
SET PAGESIZE 0
SET FEEDBACK OFF
SET HEADING OFF
SET trimspool on
--set echo on ;
spool home/test.log;
SELECT id||','||first_name||','||last_name||','||salary FROM <table_name>
spool off;