Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

create a tab in the excel sheet by shell script

N_RajJan 3 2018 — edited Jan 3 2018

Hi All,

We have oracle 11.2.0.4 on Aix 7.

I am asked to prepare a shell script to send a output to excel file.

Script

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

export ORACLE_HOME=/u01/ora

export ORACLE_SID=TEST

export PATH=$ORACLE_HOME/bin:$PATH

sqlplus -s "username/password@test" << EOF

spool Jan_01.xls;

set echo on;

set timing on;

set time on ;

select name from v\$database;

EOF

spool off;

exit;

uuencode Jan_01.xls Jan_01.xls; | mail -s " Nov_06" xyz@m.com

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The above sql statement is not actual one.

The output is fine in the excel sheet.But i can see only output. Not actual query "select name from v\$database;". we need actual sql statement also in another tab.

It should be also added in another tab of excel sheet.Not the same tab of the output.

Any Suggestions.

Thanks & Regards

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 31 2018
Added on Jan 3 2018
2 comments
1,247 views