--I hade some adjustments based on Norm's email . I am not at work / no access to Toad.
--I removed one set command and changed headings to off
--also you don't need a group by
set pagesize 0
set trimspool on
set echo off
set embedded off
set feedback off
set heading off
set serveroutput on
set linesize 2000
spool D:\BK210.txt
begin
dbms_output.enable(100000);
dbms_output.put_line('CLI;AGE;NCP;DEV'); --these are your column headings
end;
/
Select d.cli||';'||d.age||';'||d.ncp||';'||d.dev
from prod.bkhis d
group by d.cli, d.age, d.ncp, d.dev
order by d.cli asc
;
spool off
exit
On Sun, Jul 2, 2017 at 10:03 AM, mbellemax bounce-mbellemax@toadworld.com wrote:
RE: How do I add the colum'names in exporting SQL to text using Run as script
Reply by mbellemax
Hello Gene
Thanks really for your reply.
I don't really unsderstand the last instruction (dbms.output.putline) but i've tried to modify the query like this adding what you have noticed
Is this correct (I've used the ";" separator) ?
Thanks
--QUERY TOP --
set pagesize 0
set trimspool on
set headsep on
set echo off
set embedded off
set feedback off
set heading on
set serveroutput on
set linesize 2000
dbms.output.putline
spool D:\BK210.txt
Select dbms.output.putline (d.cli||';'||d.age||';'||d.ncp||';'||d.dev)
from prod.bkhis d
group by d.cli, d.age, d.ncp, d.dev
order by d.cli asc
;
spool off
--QUERY BOTTOM--
To reply, please reply-all to this email.
Stop receiving emails on this subject.
Or Unsubscribe from Toad for Oracle Forum notifications altogether.
Toad for Oracle - Discussion Forum
Flag this post as spam/abuse.
--
Gene L. Bradley Jr.
Systems Analyst
Office of Information Technology
Jackson State University
1400 J R Lynch Street
P.O. Box 17750
Jackson, MS 39217
ph 601.979.1042
fax 601.371.9146
email gbradley@jsums.edu
*In God we trust; all others bring data. * ~W.E. Deming

CONFIDENTIALITY STATEMENT
This electronic transmission is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone (601) 979-1042. Thank you.