RelationalDBDesign RelationalDBDesign


SQL* Plus CLI  «Prev  Next»
Lesson 3 Column formatting
Objective Use SQL*Plus COLUMN command to format output.
The COLUMN command is used to format columns, and allows you to produce reports that are easy to read and understand.
The following mouseover shows the syntax for the most commonly used elements of the COLUMN command.
  1. This is the command, and it may be abbreviated to COL.
  2. Represents the column name from the SQL query.
  3. The HEADING keyword introduces the text that you want to use for the column heading. The default is to use the column name. HEADING may be abbreviated to HEA.
  4. Represents the heading text. Single quotes may be used instead of double. The quotes can be left off entirely if the heading is just one word, containing no special characters.
  5. Introduces the format specification that you want to use for the column. FORMAT may be abbreviated to FOR.
  6. Represents the column's format specification. This is a string of characters that controls how the column's data are displayed on the report.
  7. Tells SQL*Plus to truncate column values in order to make them fit the display width. The abbreviation TRU may be used.
  8. Tells SQL*Plus to display long values using multiple lines, and to word-wrap the lines. In other words, a line will not be broken in the middle of a word. The abbreviation WOR may be used for this.
  9. Tells SQL*Plus to display long values using multiple lines, and to break each line exactly at the display width regardless of whether or not the line break occurs in the middle of a word. The abbreviation WRA may be used.
  10. The JUSTIFY clause controls the manner in which the column heading is aligned over the column. JUSTIFY may be abbreviated to JUS.
  11. May be either RIGHT, LEFT, or CENTER. For text columns, the default is LEFT. For numeric columns it is RIGHT.

Column Command Syntax
The most critical clause in the COLUMN command is the FORMAT clause, which controls how column data are formatted.
The next three lessons talk about this in terms of text, numeric, and date column types.

Oracle Column Command

Click the link below to read about the COLUMN command.
Oracle Column Command