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!

Oracle 11gR2: SQL*Plus spool file - append

Ora_Learner890Oct 17 2019 — edited Oct 17 2019

hi all,

I have created following script file, when I run it contain 1 blank line before and 2 lines between both output, how I can have no lines before and in between and eliminate last line is " 50 rows selected " - definitely i am missing SQL*Plus option to use, please help/guide.

set head off

set termout off

column dtcol new_value SYSDATE noprint

select to_char(sysdate,'YYYYMMDD') dtcol from dual;

spool E:\Test\testlog.&sysdate.csv create

select 'EMPID,LAST_NAME,DATE' from dual;

spool off

spool E:\Test\testlog.&sysdate.csv append

select employee_id||','||last_name||','||to_char(hire_date,'DDMMYYYY') Data

from (select * from employees order by 1)

where rownum<=50;

spool off

set termout on

Output is:

EMPID,LAST_NAME,DATE                      

100,King,17062003                                                                                                                                                                                      

101,Kochhar,21092005                                                                                                                                                                                   

102,De Haan,13012001                                                                                                                                                                                   

103,Hunold,03012006

...

50 rows selected.

the requirement is to generate this file during oracle job which calls a procedure to send email, I have to maintain Log in CSV in both cases Success or Failure of each and every emails. is it correct approach or any better idea ?

regards

This post has been answered by Sunny kichloo on Oct 17 2019
Jump to Answer
Comments
Post Details
Added on Oct 17 2019
2 comments
3,288 views