SQL Extensions   «Prev 

SQL*Plus Report Commands

TITLE LEFT "Customer Purchasing" -
SKIP 1 "Pq." SQL.PN0 SKIP 2
COMPUTE SUM OF TOTAL_SALE ON LASTNAME
BREAK ON LASTNAME SKIP 1
Compute Sum of Total Sale on Last Name

  1. This is the title of the report. The dash at the end of the first line is needed because the TTITLE command was continued to the second line.
  2. The COMPUTE command here tells SQL*Plus to calculate the sum of the TOTAL_SALE column when there is a break on the LASTNAME column.
  3. The BREAK command here says that the report will break on each new value of the LASTNAME column and then skip one line.
  4. This query is executed.
  5. The first line of the report title. The TTITLE command said to place these words, left justified on the first line of the report and then skip one line (meaning go to the next line).
  6. This is the beginning of the second line of the report title. The TTITLE command (second line of the command) stated to print "Pg."
  7. This is the page number, which is displayed because the TTITLE contains the SQL*Plus variable called SQL.PNO. This is one of a small handful of pre-defined variables within SQL*Plus.
  8. This blank line is here because the TTITLE says "SKIP 2" at the end of the command.
  9. These two lines are printed when the BREAK stops printing rows and the COMPUTE command prints its results (the sum of TOTAL_SALE).
  10. This blank line is the action taken by the BREAK command (SKIP 1). After this line, the next row of the report is printed.