Chapter 14 Formatting Readable Output
Chapter Objectives Add a column heading with a line break to a report Format the appearance of numeric data in a column Specify the width of a column Add a column heading with a line break to a report Format the appearance of numeric data in a column Specify the width of a column
Chapter Objectives Substitute a text string for a NULL value in a report Add a multiple-line header to a report Display a page number in a report Add a footer to a report Substitute a text string for a NULL value in a report Add a multiple-line header to a report Display a page number in a report Add a footer to a report
Chapter Objectives Change the setting of an environment variable Suppress duplicate report data Clear changes made by the COLUMN and BREAK commands Perform calculations in a report Change the setting of an environment variable Suppress duplicate report data Clear changes made by the COLUMN and BREAK commands Perform calculations in a report
Basic Report Creation in SQL*Plus Enter format for the report Enter a query to retrieve data Enter format for the report Enter a query to retrieve data
COLUMN Command Formats both column heading and data displayed in column
COLUMN Command Options
FORMAT Option Specifies format model for the data
FORMAT Example
HEADING Option Specifies a column heading
Output with HEADING Option
SET Command SET command used to change the UNDERLINE variable Assign blank space to add separator with FORMAT option of COLUMN command SET command used to change the UNDERLINE variable Assign blank space to add separator with FORMAT option of COLUMN command
Modified Report
NULL Option Provides substitute for NULL values
Report Headers and Footers Header –Appears at top of reports –Created with TTITLE command Footer –Appears at bottom of reports –Created with BTITLE command Header –Appears at top of reports –Created with TTITLE command Footer –Appears at bottom of reports –Created with BTITLE command
TTITLE and BTITLE Options
SQL*Plus Variables
BREAK Command Suppresses duplicate data Allows blank lines after groups Suppresses duplicate data Allows blank lines after groups
BREAK Command Example
CLEAR Command Used to clear settings applied to the BREAK and COLUMN commands
COMPUTE Command Can include AVG, SUM, COUNT, MAX, or MIN keywords
COMPUTE Command Example
SPOOL Command Saves results to text file
SPOOL Command Example