SQL Plus - Column Command

> Procedural Languages > (SQL Plus|SqlCl) (Oracle Database Console)

1 - About

The column command:

  • specifies display attributes for a given column, such as:
    • text for the column heading
    • alignment for the column heading
    • format for NUMBER data
    • wrapping of column data
  • lists the current display attributes for a single column or all columns.
  • can set a substitution variable from a sql via the sql column name
Advertising

3 - Syntax

COL[UMN] [{column | expr} [option ...] ]

where:

  • column is the column name of an SQL
  • option represents one of the following clauses:
Options Description
ALI[AS] alias
CLE[AR] To Suppress the formatting of the column. See FORMAT
ENTMAP {ON|OFF}
FOLD_A[FTER]
FOLD_B[EFORE]
FOR[MAT] format To format the report. See FORMAT
HEA[DING] text Define the headers text of the column. With the |, you can go to the line.
JUS[TIFY] {L[EFT] | C[ENTER] | R[IGHT]} Define the justification (Default: Left)
LIKE {expr | alias} See copy
NEWL[INE]
NEW_V[ALUE] variable will set the substitution variable variable with the value of the column name of the SQL
NOPRI[NT] | PRI[NT] will not print (hide) the column
NUL[L] text See Null
OLD_V[ALUE] variable
ON|OFF
WRA[PPED] | WOR[D_WRAPPED] | TRU[NCATED] See wrap
Advertising

4 - Options

4.1 - Heading

The heading option controls the headers.

COLUMN TABLE_NAME HEADING 'Table|Name'

will produce for the column TABLE_NAME the following output:

Table
Name

5 - Management

5.1 - Copy

The LIKE clause copies the display attributes of a previously defined column to the new column, except for changes made by other clauses in the same command.

Example: To give the column COMMISSION_PCT the same display attributes you gave to SALARY, but to specify a different heading, enter the following command:

COLUMN COMMISSION_PCT LIKE SALARY HEADING BONUS

5.2 - Suppress

5.2.1 - for one column

You can reset the column's format with

COLUMN column_name CLEAR

or exit from SQL*Plus.

Advertising

5.2.2 - for all columns

See clear

5.3 - See

5.3.1 - all

column

5.3.2 - one

column column_name
lang/sqlplus/column.txt · Last modified: 2017/05/09 16:51 by gerardnico