列标题不断出现在整个 Oracle 输出中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7617396/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 03:36:19  来源:igfitidea点击:

Column headings keep appearing throughout Oracle output

oraclesqlplus

提问by smiligrl

After ever 10 lines, my column headers reappear in my Oracle output. Is there something about my code or some kind of environment variable I can set to stop this? I only need the column headers to appear once at the top of my results.

在 10 行之后,我的列标题重新出现在我的 Oracle 输出中。有什么关于我的代码或某种环境变量可以设置来阻止它吗?我只需要列标题在我的结果顶部出现一次。

BREAK ON Customer
COLUMN Customer -
       FORMAT A15 -
       HEADING 'Customer Name'
COLUMN "Charter Date" -
       HEADING 'Charter|Date'
COLUMN Pilot -
       FORMAT A20 -
       HEADING 'Pilot'
SELECT DECODE (cu.cus_initial,null, cu.cus_fname||' '||cu.cus_lname,
       cu.cus_fname||' '||cu.cus_initial||'. '||cu.cus_lname)
       AS Customer,
       ch.char_date "Charter Date",
       TRIM( e.emp_fname) ||' '|| TRIM(e.emp_lname) AS "Pilot"
FROM hartmar.customer cu,
     hartmar.charter ch,
     hartmar.crew cr,
     hartmar.pilot p,
     hartmar.employee e
WHERE cu.cus_code = ch.cus_code
      AND ch.char_trip = cr.char_trip
      AND cr.emp_num = p.emp_num
      AND p.emp_num = e.emp_num
      AND cr.crew_type = 'Pilot'
ORDER BY cu.cus_lname, cu.cus_fname, cu.cus_initial, ch.char_date
;

CLEAR BREAKS
CLEAR COLUMNS

回答by Justin Cave

Assuming you're running this in SQL*Plus, you need to set your pagesize.

假设您在 SQL*Plus 中运行它,您需要设置页面大小。

SET PAGESIZE 50000

will cause the columns headings to appear only once for every 50,000 rows returned. I believe 50,000 is the maximum PAGESIZE setting.

将导致每返回 50,000 行列标题仅出现一次。我相信 50,000 是最大的 PAGESIZE 设置。

If you want to eliminate headers entirely, you can set the PAGESIZEto 0 but that will suppress even the first set of headers

如果你想完全消除标题,你可以将 设置PAGESIZE为 0 但这甚至会抑制第一组标题

SQL> set pagesize 0;
SQL> select ename, empno from emp;
PAV              7623
smith            7369
ALLEN            7499
WARD             7521
JONES            7566
MARTIN           7654
BLAKE            7698
CLARK            7782
SCOTT            7788
KING             7839
TURNER           7844
ADAMS            7876
SM0              7900
FORD             7902
MILLER           7934
BAR              1234

16 rows selected.

回答by dsz

Use a 'hidden' feature that will suppress all EXCEPT the first row of headings!

使用“隐藏”功能将抑制除第一行标题之外的所有内容!

set pagesize 0 embedded on

Thanks to "Bruno Ruess" via https://community.oracle.com/thread/2389479?start=0&tstart=0for the above.

感谢“Bruno Ruess”通过https://community.oracle.com/thread/2389479?start=0&tstart=0以上。

If you then also add

如果您还添加

SET UNDERLINE off

Then you can supress the "underlining" of the header row, and get to something that looks a lot more like a CSV.

然后您可以取消标题行的“下划线”,并获得看起来更像 CSV 的内容。

回答by Bart K

You can also:

你也可以:

SET PAGESIZE 0

To stop all column headers after the start of your report.

在报告开始后停止所有列标题。