Skip to Main Content

SQL & PL/SQL

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!

set command to spool query with result o/p

KK23Aug 24 2017 — edited Aug 24 2017

Hi  All ,

I have requirement , following shell script and sql are using. Need your help to get sql query with result o/p in spooling fiie.

shell script

Generate_sql ()

{

sqlplus -s <<-EOF

${PBDW_USERID}/${PBDW_PWD}@${PBDW_SID}

@temp.sql

EOF

}

temp.sql file

set echo on;

spool temp.log

select EMP_NAME from emp;

spool off;

O/P

A

B

C

Required o/p

select EMP_NAME from emp;

EMP_NAME

A

B

C

Need you help to get spool file with query and results set.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 21 2017
Added on Aug 24 2017
8 comments
1,333 views