sqlplus -s $username/$password <<EOF
SET COLSEP ','
SET feedback off
SET newpage none
SET pagesize 0
SET linesize 10000
SET verify off
SET pagesize 0
SET term off
SET trims ON
SET heading off
SET trimspool ON
SET trimout ON
SET timing off
SET verify off
spool /$path/$table.txt
SELECT * form table1
spool off
EOF