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!

Need Sql statement with output in excel sheet

N_RajJan 8 2018 — edited Jan 9 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. the output comes without actual sql statement ( select name from v\$database; ).

But we need the actual query also in the same tab ( excel sheet ) with output. Is it possible.

And

How to add a sql statement in the existing Jan_01.xls?

Any suggestions

Thanks & Regards,

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 6 2018
Added on Jan 8 2018
8 comments
1,258 views