Database Reference
In-Depth Information
A few notes about the COLUMN command:
The COLUMN command uses the alias of the column in the query,
not the column prefixed with the schema. For example, in the
CDREPORT.SQL script file, use CDTITLE in the COLUMN com-
mand, not M.TITLE.
The vertical bar ( | ) indicates a line break in the heading. See the
COLUMN command for the SONGTITLE column.
WORD_WRAP makes column data break between words, whereas
WRAP always breaks at the exact width defined in the FORMAT.
The COLUMN command should be on a single line. To make
SQL*Plus read a second line, add a dash or hyphen ( - ) to the end of
the first line, indicating that the second line is a continuation of the
first line. See the COLUMN command for the SONGTITLE column.
A COLUMN command is in effect for your entire session or until
you issue another COLUMN command on the same column or
expression.
The COLUMN command can be used to format character and num-
ber data but not dates. Format dates using the TO_CHAR function
in the query.
Let's take a look at formatting of dates.
8.3.1.1
Formatting Dates
Here is a query containing a date column:
COLUMN TITLE FORMAT A30 WRAP
SELECT S.TITLE, S.RECORDING_DATE FROM SONG S
WHERE S.RECORDING_DATE > '01-JUL-2001';
Dates cannot be formatted with the COLUMN FORMAT command,
except to limit the width of the column. Let's add general formatting for all
dates by adjusting the default date format for the current session.
ALTER SESSION SET NLS_DATE_FORMAT = 'Day, Month DD, YYYY';