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

From: Peter van der Kooi <kooi_at_telecom.ptt.nl>
Date: 1995/08/04
Message-ID: <3vseqs$nk6_at_hdxx05.telecom.ptt.nl>#1/1


Darryl Snedeker x52168 <dsnedeke> wrote:
>break on report;
>compute sum of salary on report;
>
>select deptno, employee_name, salary
>from emp
>order by deptno, employee_name;
>
>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. I am
>fairly certain I have seen this worked out before, but is has been 3-4 years
>and
>I cannot find the notes I once had.
>
>Please don't respond by saying this can't be done, I've already heard from your
>premier representative.
>

You can alias the column saying:

select

	deptno		"Department Number"
	,emp		"Employee"
from
	emp

Or by giving the column a format:

column DepartmentNumber format a20
column Employee format a15

select

	deptno		DepartmentNumber
	,emp		Employee
from 
	emp




Peter van der Kooi
Master DBA Received on Fri Aug 04 1995 - 00:00:00 CEST

Original text of this message