将列标题删除到输出文本文件中 [英] Remove Column Header into the Output Text file
问题描述
我想从Oracle SQL Developer创建查询的平面文件(文本文件).
I want to create a flat file (text file) of my query from Oracle SQL Developer.
我已经通过脚本文本文件使用SPOOL成功创建了文本文件,但是我想将每列的标题删除到输出中.
I have successfully created the text file using SPOOL, thru a script text file, but i want to remove the header of each column into my output.
我得到以下输出:
Header000001 Header000002
------------ ------------
Adetail1 Bdetail1
Adetail2 Bdetail2
Adetail3 Bdetail3
但是,我想得到以下输出:
But, I want to get this output:
Adetail1Bdetail1
Adetail2Bdetail2
Adetail3Bdetail3
我已经尝试过"set heading off"命令,但是出现一条消息:
I already tried the command "set heading off", but a message says:
"SQLPLUS COMMAND Skipped: set heading off".
这些是我发布的信息:
spool on;
spool C:\SQLFiles\PSB_ATMLKP.txt;
set newpage 0;
set echo off;
set feedback off;
set heading off;
select terminal_number, terminal_name from terminal_table;
spool off;
推荐答案
SQLPLUS COMMAND跳过:开始前进
SQLPLUS COMMAND Skipped: set heading off
该消息很可能是因为您不是通过SQL*Plus
而是通过某些基于GUI的工具来执行该消息.您正在SQL Developer中使用SQLPlus命令.并非所有SQL * Plus命令都保证可以与 SQL Developer 一起使用.
That message is most likely because you are not executing it through SQL*Plus
, but some GUI based tool. You are using SQLPlus command in SQL Developer. Not all SQL*Plus commands are guaranteed to work with SQL Developer.
我建议您在 SQLPlus 中执行脚本,并且不会出现任何问题.
I would suggest you execute the script in SQLPlus and you would see no issues.
您需要:
SET HEADING OFF
这不会在输出中包括列标题.
This will not include the column headers in the output.
或者,您也可以这样做:
Alternatively, you could also do this:
SET PAGESIZE 0
使用SQL Developer 3.2.20.10 :
spool ON
spool D:\test.txt
SET heading OFF
SELECT ename FROM emp;
spool off
创建的假脱机文件没有问题:
Spool file got created with no issues:
> set heading OFF
> SELECT ename FROM emp
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER
14 rows selected
这篇关于将列标题删除到输出文本文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!