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

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

SET NEWPAGE 0
SET SPACE 0
SET PAGESIZE 0
SET ECHO OFF
SET TERMOUT OFF
SET FEEDBACK OFF
SET TRIMSPOOL ON
SET HEADING ON
set feed off markup html on spool on

SPOOL /tmp/orhan/a.html

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
——————————————