Re: SQL*Plus TTITLE Incorrect on Last Page

From: Karsten Farrell <kfarrell_at_belgariad.com>
Date: Thu, 31 Jul 2003 22:44:59 GMT
Message-ID: <MPG.19933bba64135b4d98981d_at_news.la.sbcglobal.net>


Hi Lisa Tracy, thanks for writing this:
> I posted this request for help to comp.databases.oracle last week, but
> didn't receive any responses. I'm hoping the tools group might yield
> a suggestion or two. I know SQL*Plus isn't a very glamorous tool
> these days, but I'd really appreciate any help you can provide.
>
> I have an irritating little puzzle that I'd love suggestions for
> solving. I am using Oracle 8.0.4, and have a SQL*Plus report that
> gathers labor costs by project number for a given accounting period.
> The project number appears in the TTITLE of the report, like this:
>
> TTITLE LEFT 'PROJECT NUMBER: ' projno SKIP 1 - ...
>
> And of course I have a COLUMN definition like this:
>
> COLUMN project_no NEW_VALUE projno FORMAT A1 NOPRINT
>
> This report BREAK's on the project number, and on the report, with a
> page break between each project. And we COMPUTE the SUM of the labor
> costs by both project number, and for the report.
>
> The puzzle is this: The last page of the report doesn't contain any
> detailed data, only the total labor costs for the report's accounting
> period. But the TTITLE for this page still displays the project
> number from the previous page.
>
> Will I have to split the report total out into a separate query, with
> separately defined TTITLE, or is there a way to control the project
> number display (preferably leave it blank) for the last page of the
> report?
>
> Thanks for your help!!!
>

My news server doesn't carry c.d.o, so I didn't see your post there.

You might be forced to accept it as is or, as you say, make the totals a separate report. When I lookup "Print Grand Totals" in Gennick's _Oracle SQL*Plus_ book, he points out this problem. Your *projno* variable is only updated when new data is retrieved from the db. But when the grand total page prints, there are no more records and the old value is left there.

<quote>
It would be nice if SQL*Plus were smart enough to make this [last value retrieved from the database] null or blank, but it isn't. The value in the header is refreshed only when a new value is read from the database, and in the case of a report break, that simply doesn't happen. </quote>

-- 
[:%s/Karsten Farrell/Oracle DBA/g]
Received on Fri Aug 01 2003 - 00:44:59 CEST

Original text of this message