Sql*Plus User’s Guide and Reference


Formatting SQL*Plus Reports 6-1


Download 5.34 Mb.
Pdf ko'rish
bet78/103
Sana04.08.2023
Hajmi5.34 Mb.
#1665146
1   ...   74   75   76   77   78   79   80   81   ...   103
Bog'liq
E18404-12

6
Formatting SQL*Plus Reports
6-1
6
 Formatting SQL*Plus Reports
This chapter explains how to format your query results to produce a finished report. 
This chapter does not discuss HTML output, but covers the following topics:

Formatting Columns

Clarifying Your Report with Spacing and Summary Lines

Defining Page and Report Titles and Dimensions

Storing and Printing Query Results
Read this chapter while sitting at your computer and try out the examples shown. 
Before beginning, make sure you have access to the HR sample schema described in 
SQL*Plus Quick Start
 on page xix.
Formatting Columns
Through the SQL*Plus COLUMN command, you can change the column headings 
and reformat the column data in your query results.
Changing Column Headings
When displaying column headings, you can either use the default heading or you can 
change it using the COLUMN command. The following sections describe how default 
headings are derived and how to alter them using the COLUMN command. See the 
COLUMN
 command on page 12-26 for more details.
Default Headings
SQL*Plus uses column or expression names as default column headings when 
displaying query results. Column names are often short and cryptic, however, and 
expressions can be hard to understand.
Changing Default Headings
You can define a more useful column heading with the HEADING clause of the 
COLUMN command, in the following format:
COLUMN column_name HEADING column_heading
Example 6–1
Changing a Column Heading
To produce a report from EMP_DETAILS_VIEW with new headings specified for 
LAST_NAME, SALARY, and COMMISSION_PCT, enter the following commands:
COLUMN LAST_NAME HEADING 'LAST NAME'


Formatting Columns
6-2
SQL*Plus User's Guide and Reference
COLUMN SALARY HEADING 'MONTHLY SALARY'
COLUMN COMMISSION_PCT HEADING COMMISSION
SELECT LAST_NAME, SALARY, COMMISSION_PCT
FROM EMP_DETAILS_VIEW
WHERE JOB_ID='SA_MAN';
To change a column heading to two or more words, enclose the new heading in single 
or double quotation marks when you enter the COLUMN command. To display a 
column heading on more than one line, use a vertical bar (|) where you want to begin 
a new line. (You can use a character other than a vertical bar by changing the setting of 
the HEADSEP variable of the SET command. See the 
SET
 command on page 12-88 for 
more information.)

Download 5.34 Mb.

Do'stlaringiz bilan baham:
1   ...   74   75   76   77   78   79   80   81   ...   103




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling