Document ID:         2176.1
Subject:            MISSING LABEL WHEN COMPUTING IS DONE ON THE FIRST COLUMN
Last Revision Date: 31 July      1996
Author:		    Mylan Bui


PROBLEM:
=======

   My label is missing when doing computes of the first column
   on a report break. In other words, suppose I do the
   following in SQL*Plus:

SQL> break on report
SQL> compute count of deptno on report
SQL> select * from dept;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
----------
         4

Notice the lack of the 'count' label. This happens in
report breaks where the computation is performed on the
first column. Normally, the compute labels for a report
break always appear in the first column.  For example,
if I had performed the count computation on the second
column, DNAME, I would have gotten:

SQL> clear computes
computes cleared
SQL> compute count of dname on report
SQL> select * from dept;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
           --------------
count                   4

In this case, no computation is performed on the first
column so SQL*Plus is free to place the "count" label
in the first column.

RESOLUTION:
==========

   The following approach was proposed: use a "dummy"
first column to hold the compute label when you want a
compute of the first column on a report break. Here's
how it works with our original example:

SQL> clear computes
computes cleared
SQL> clear breaks
breaks cleared
SQL> break on report
SQL> compute count of deptno on report
SQL> col summary format a7
SQL> select ' ' summary, dept.* from dept;

SUMMARY     DEPTNO DNAME          LOC
------- ---------- -------------- -------------
                10 ACCOUNTING     NEW YORK
                20 RESEARCH       DALLAS
                30 SALES          CHICAGO
                40 OPERATIONS     BOSTON
        ----------
count            4

Thus, we create a dummy leftmost column named SUMMARY
(or whatever is appropriate) to hold the "count" label.
Notice that as the first element of the SELECT list
we specify the constant expression ' ' (a blank string)
and give it a column alias of SUMMARY.