Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to display variable value in Compute label of SQL report

Status
Not open for further replies.

saketbansal

IS-IT--Management
Jul 2, 2003
41
Hi,

The problem is in MASTER_DEATIL report in SQL

I have the value of job column in variable job_var. Now my requirement is when SUM is done for every job i want the label of the sum = SUM of <JOBNAME>. I am not able to do it.This code displays records job wise when job changes the page break is there and the job is displayed in title.

Please find the code.
==============
SET NEWPAGE 0
SET PAGESIZE 56
clear columns
clear breaks
clear computes
undefine job_var
--Set the linesize, which must match the number of equals signs used
--for the ruling lines in the headers and footers.
SET LINESIZE 180
--Set up page headings and footings
TTITLE CENTER 'The Fictional Company' SKIP 3 -
LEFT 'I.S. Department' -
RIGHT 'Project Hours and Dollars Detail' SKIP 1 -
LEFT '========================================' -
'==========================' -
SKIP 2 'job: ' FORMAT A15 job_var
BTITLE LEFT '========================================' -
'==========================' -
SKIP 1 -
RIGHT 'Page ' FORMAT 999 SQL.PNO

--Format the columns

COLUMN job NEW_VALUE job_var
set heading on

--Breaks and Computations
BREAK ON job SKIP page NODUPLICATES

compute sum label 'sum-&job_var' of sal on job;

--Execute the query to generate the report.
SELECT JOB, deptno,ENAME , SAL FROM EMP
ORDER BY JOB;

define
 
SaketBansal,

I'm sorry, but I'm not aware of a way in SQL*Plus to iteratively change a label on a sum during the display of the result set.

You can, however, set a SUM label to a single, specific replacement string PRIOR to executing your SELECT, but I do not believe you can iteratively change a SUM label during output.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top