Re: SQLPLUS Tricky Question...Where are the SQL Gurus ??

From: Christopher Jones <cjones_at_au.oracle.com>
Date: 1995/08/07
Message-ID: <x7lot67i0d.fsf_at_hurrah.au.oracle.com>#1/1


In article <DCqtM5.ME7_at_txnews.amd.com> Darryl Snedeker <dsnedeke> writes:

> The above script, as you know, will produce a listing of all employees
> and will order by department number. For each department, a sum of
> salaries will be computed. The string 'Sum ' will appear on the same
> line as each total.
>
> How do I change this string 'Sum' to appear as another literal string.

SQL*Plus 3.2 has a new LABEL option to the COMPUTE command that helps:

  % sqlplus scott/tiger

  SQL*Plus: Release 3.2.2.0.0 - Production on Mon Aug 7 08:55:01 1995   Copyright (c) Oracle Corporation 1979, 1994. All rights reserved.   Connected to:
  Oracle7 Server Release 7.2.2.0.0 - Production Release   PL/SQL Release 2.2.2.0.0 - Production

  SQL> compute sum label "My Sum" of deptno on report
  SQL> break on report
  SQL> select dname, deptno from dept;

  DNAME            DEPTNO
  -------------- ----------
  ACCOUNTING             10
  RESEARCH               20
  SALES                  30
  OPERATIONS             40
                 ----------
  My Sum                100

  SQL>

-- 
Christopher Jones, cjones_at_au.oracle.com
Received on Mon Aug 07 1995 - 00:00:00 CEST

Original text of this message