Aşağıdaki spool.sh dosyası içeriğinde görüldüğü gibi
sorgu sonucu belirli bi formatta excel dosyasına(a.xls)
aktarılır.

————————————————–
#!/usr/bin/ksh
. $HOME/.profile

sqlplus -s /nolog < /dev/null
connect user/password@db

SET LINESIZE 1024;
SET HEADING OFF;
SET PAGESIZE 0;
SET FEEDBACK OFF;
SET TRIMSPOOL ON;
alter session set nls_date_format=’DD.MM.YYYY’;
SPOOL /tmp/orhan/a.xls

select tarih||chr(9)||plan||chr(9)||procedure||chr(9)||end_date||chr(9)||job_order from tablo where status=’COMPLETED’
and tarih between to_date(‘29.03.2009′,’DD.MM.YYYY HH24:MI:SS’) and to_date(‘30.03.2009′,’DD.MM.YYYY HH24:MI:SS’) and procedure like ‘PLAN_A%’
group by tarih,plan,procedure,end_date,job_order order by plan;

SPOOL OFF
set markup html off spool off
EXIT SQL.SQLCODE;
EOF
————————————————