6.3. Formatting SQL*Plus Output

While SQL*Plus provides some basic default formatting of output, you can also customize your output in various ways to produce "finished" reports. The following commands implement the formatting capabilities of SQL*Plus. You can enter these commands from a SQL*Plus prompt or include them in a SQL*Plus script.

BREAK (With Parameters)
BRE[AK]  [ON column | expression | ROW | REPORT [action [action]]]. . .

Specify where and how to change the formatting of a report. BREAK is often used with COMPUTE to generate totals and subtotals.

Keywords

column

Causes the specified action to occur whenever the value of the specified column changes.

expression

Causes the action to occur whenever the value of the specified expression (which must exactly match an expression in the SELECT statement) changes.

ROW

Causes the action to occur whenever SQL*Plus returns a row.

REPORT

Causes the corresponding COMPUTE command to be executed at the end of the report.

action

Can be one or more of the following:

SKI[P]

Skips n lines before printing the row on which the break occurred.

SKI[P] PAGE

Skips the necessary number of lines to advance to a new page. If SET NEWPAGE was specified, prints a formfeed character.

NODUP[LICATES]

Causes blanks to be printed instead of the value of the break column when the value is the same as the value in the preceding row.

DUP[LICATES]

Causes the value of the break column to be printed for every row, regardless of whether or not the value ...

Get Oracle SQL: the Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.