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

发布于 2024-12-07 06:02:38 字数 940 浏览 0 评论 0原文

每 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

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.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

内心荒芜 2024-12-14 06:02:38

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

SET PAGESIZE 50000

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

如果您想完全消除标头,可以将 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.

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

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.

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

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.
绾颜 2024-12-14 06:02:38

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

set pagesize 0 embedded on

感谢“Bruno Ruess”,来自 https://community.oracle.com/ thread/2389479?start=0&tstart=0 对于上述内容。

如果您还添加了“Then

SET UNDERLINE off

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

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=0 for the above.

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.

堇色安年 2024-12-14 06:02:38

您还可以:

SET PAGESIZE 0

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

You can also:

SET PAGESIZE 0

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文