Hi,
I have to send the query output as an excel attachmet from UNIX Shell script, for this i have written following shell script and sql file this shell script has created the ho.xls file with correct query output but it doesn't generate the mail that shold contain query output as an excel attachment, could anyone please tell me the correct script for my requirement.
Will the script generate the log file as an excel file?
I am using Sun OS 5.6 and Oracle 8i
ho.sh
------
#!/bin/csh
setenv ORACLE_HOME /opt/app/oracle/product/8.1.7
setenv ORACLE_SID environ
set BINARIES=/usr/bin
set APPDIR=/u08/Temp
$ORACLE_HOME/bin/sqlplus uname/pwd @$APPDIR/ho.sql > $APPDIR/ho.xls
uuencode $APPDIR/ho.xls $APPDIR/ho.xls | /usr/bin/mailx -s "Attachment"
karthikeyanjo@hcl.in
ho.sql
------
set lines 200
set pagesize 100
select to_char(transaction_date,'HH24')||':00 - '||to_char(transaction_date,'HH24')||':59' "Hour",
count(*) "Total_Hits"
from adsl_interface_log_cng
where trunc(transaction_date)=trunc(sysdate-1)
AND (decode(TRANSLATE(UPPER (adsl_ra_reasoncode),'1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!"##$%^&*()-_=+[{]}@;:#~,<.>/?`?/'' ','1234567890'),0,NULL,
TRANSLATE(UPPER (adsl_ra_reasoncode),'1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!"##$%^&*()-_=+[{]}@;:#~,<.>/?`?/'' ','1234567890'))
/10) < 2
group by to_char(transaction_date,'HH24')
order by to_char(transaction_date,'HH24');