6

Column headers continue to appear in the Oracle output

 2 years ago
source link: https://www.codesd.com/item/column-headers-continue-to-appear-in-the-oracle-output.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Column headers continue to appear in the Oracle output

advertisements

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


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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK